1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-11 13:10:58 +00:00

Move editor paths into the EditorPaths class

This commit is contained in:
Aaron Franke
2022-07-28 19:36:26 -05:00
parent 5352cf8e2f
commit ac870ab1c8
19 changed files with 122 additions and 116 deletions

View File

@@ -45,7 +45,7 @@
void ExportTemplateManager::_update_template_status() {
// Fetch installed templates from the file system.
Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
const String &templates_dir = EditorSettings::get_singleton()->get_export_templates_dir();
const String &templates_dir = EditorPaths::get_singleton()->get_export_templates_dir();
Error err = da->change_dir(templates_dir);
ERR_FAIL_COND_MSG(err != OK, "Could not access templates directory at '" + templates_dir + "'.");
@@ -438,7 +438,7 @@ bool ExportTemplateManager::_install_file_selected(const String &p_file, bool p_
}
Ref<DirAccess> d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
String template_path = EditorSettings::get_singleton()->get_export_templates_dir().plus_file(version);
String template_path = EditorPaths::get_singleton()->get_export_templates_dir().plus_file(version);
Error err = d->make_dir_recursive(template_path);
if (err != OK) {
EditorNode::get_singleton()->show_warning(TTR("Error creating path for extracting templates:") + "\n" + template_path);
@@ -537,7 +537,7 @@ void ExportTemplateManager::_uninstall_template(const String &p_version) {
void ExportTemplateManager::_uninstall_template_confirmed() {
Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
const String &templates_dir = EditorSettings::get_singleton()->get_export_templates_dir();
const String &templates_dir = EditorPaths::get_singleton()->get_export_templates_dir();
Error err = da->change_dir(templates_dir);
ERR_FAIL_COND_MSG(err != OK, "Could not access templates directory at '" + templates_dir + "'.");
@@ -615,7 +615,7 @@ void ExportTemplateManager::_installed_table_button_cbk(Object *p_item, int p_co
}
void ExportTemplateManager::_open_template_folder(const String &p_version) {
const String &templates_dir = EditorSettings::get_singleton()->get_export_templates_dir();
const String &templates_dir = EditorPaths::get_singleton()->get_export_templates_dir();
OS::get_singleton()->shell_open("file://" + templates_dir.plus_file(p_version));
}
@@ -639,12 +639,12 @@ void ExportTemplateManager::_hide_dialog() {
}
bool ExportTemplateManager::can_install_android_template() {
const String templates_dir = EditorSettings::get_singleton()->get_export_templates_dir().plus_file(VERSION_FULL_CONFIG);
const String templates_dir = EditorPaths::get_singleton()->get_export_templates_dir().plus_file(VERSION_FULL_CONFIG);
return FileAccess::exists(templates_dir.plus_file("android_source.zip"));
}
Error ExportTemplateManager::install_android_template() {
const String &templates_path = EditorSettings::get_singleton()->get_export_templates_dir().plus_file(VERSION_FULL_CONFIG);
const String &templates_path = EditorPaths::get_singleton()->get_export_templates_dir().plus_file(VERSION_FULL_CONFIG);
const String &source_zip = templates_path.plus_file("android_source.zip");
ERR_FAIL_COND_V(!FileAccess::exists(source_zip), ERR_CANT_OPEN);
return install_android_template_from_file(source_zip);