EditorSettings: Rename settings_path to settings_dir

Also to prepare for upcoming refactoring for XDG support.
This commit is contained in:
Rémi Verschelde 2017-11-17 15:50:18 +01:00
parent 73049d115e
commit ad199c3964
19 changed files with 78 additions and 81 deletions

View file

@ -55,7 +55,7 @@
Get the list of favorite directories for this project. Get the list of favorite directories for this project.
</description> </description>
</method> </method>
<method name="get_project_settings_path" qualifiers="const"> <method name="get_project_settings_dir" qualifiers="const">
<return type="String"> <return type="String">
</return> </return>
<description> <description>
@ -77,7 +77,7 @@
<description> <description>
</description> </description>
</method> </method>
<method name="get_settings_path" qualifiers="const"> <method name="get_settings_dir" qualifiers="const">
<return type="String"> <return type="String">
</return> </return>
<description> <description>

View file

@ -41,7 +41,7 @@ void CreateDialog::popup_create(bool p_dontclear) {
recent->clear(); recent->clear();
FileAccess *f = FileAccess::open(EditorSettings::get_singleton()->get_project_settings_path().plus_file("create_recent." + base_type), FileAccess::READ); FileAccess *f = FileAccess::open(EditorSettings::get_singleton()->get_project_settings_dir().plus_file("create_recent." + base_type), FileAccess::READ);
if (f) { if (f) {
@ -63,7 +63,7 @@ void CreateDialog::popup_create(bool p_dontclear) {
favorites->clear(); favorites->clear();
f = FileAccess::open(EditorSettings::get_singleton()->get_project_settings_path().plus_file("favorites." + base_type), FileAccess::READ); f = FileAccess::open(EditorSettings::get_singleton()->get_project_settings_dir().plus_file("favorites." + base_type), FileAccess::READ);
favorite_list.clear(); favorite_list.clear();
@ -316,7 +316,7 @@ void CreateDialog::_confirmed() {
if (!ti) if (!ti)
return; return;
FileAccess *f = FileAccess::open(EditorSettings::get_singleton()->get_project_settings_path().plus_file("create_recent." + base_type), FileAccess::WRITE); FileAccess *f = FileAccess::open(EditorSettings::get_singleton()->get_project_settings_dir().plus_file("create_recent." + base_type), FileAccess::WRITE);
if (f) { if (f) {
f->store_line(get_selected_type()); f->store_line(get_selected_type());
@ -476,7 +476,7 @@ void CreateDialog::_favorite_toggled() {
void CreateDialog::_save_favorite_list() { void CreateDialog::_save_favorite_list() {
FileAccess *f = FileAccess::open(EditorSettings::get_singleton()->get_project_settings_path().plus_file("favorites." + base_type), FileAccess::WRITE); FileAccess *f = FileAccess::open(EditorSettings::get_singleton()->get_project_settings_dir().plus_file("favorites." + base_type), FileAccess::WRITE);
if (f) { if (f) {

View file

@ -337,7 +337,7 @@ Error EditorExportPlatform::_save_zip_file(void *p_userdata, const String &p_pat
String EditorExportPlatform::find_export_template(String template_file_name, String *err) const { String EditorExportPlatform::find_export_template(String template_file_name, String *err) const {
String base_name = itos(VERSION_MAJOR) + "." + itos(VERSION_MINOR) + "-" + _MKSTR(VERSION_STATUS) + "/" + template_file_name; String base_name = itos(VERSION_MAJOR) + "." + itos(VERSION_MINOR) + "-" + _MKSTR(VERSION_STATUS) + "/" + template_file_name;
String user_file = EditorSettings::get_singleton()->get_settings_path() + "/templates/" + base_name; String user_file = EditorSettings::get_singleton()->get_settings_dir() + "/templates/" + base_name;
String system_file = OS::get_singleton()->get_installed_templates_path(); String system_file = OS::get_singleton()->get_installed_templates_path();
bool has_system_path = (system_file != ""); bool has_system_path = (system_file != "");
system_file = system_file.plus_file(base_name); system_file = system_file.plus_file(base_name);
@ -692,7 +692,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
} }
String config_file = "project.binary"; String config_file = "project.binary";
String engine_cfb = EditorSettings::get_singleton()->get_settings_path() + "/tmp/tmp" + config_file; String engine_cfb = EditorSettings::get_singleton()->get_settings_dir() + "/tmp/tmp" + config_file;
ProjectSettings::get_singleton()->save_custom(engine_cfb, custom_map, custom_list); ProjectSettings::get_singleton()->save_custom(engine_cfb, custom_map, custom_list);
Vector<uint8_t> data = FileAccess::get_file_as_array(engine_cfb); Vector<uint8_t> data = FileAccess::get_file_as_array(engine_cfb);
@ -705,7 +705,7 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c
EditorProgress ep("savepack", TTR("Packing"), 102); EditorProgress ep("savepack", TTR("Packing"), 102);
String tmppath = EditorSettings::get_singleton()->get_settings_path() + "/tmp/packtmp"; String tmppath = EditorSettings::get_singleton()->get_settings_dir() + "/tmp/packtmp";
FileAccess *ftmp = FileAccess::open(tmppath, FileAccess::WRITE); FileAccess *ftmp = FileAccess::open(tmppath, FileAccess::WRITE);
ERR_FAIL_COND_V(!ftmp, ERR_CANT_CREATE) ERR_FAIL_COND_V(!ftmp, ERR_CANT_CREATE)

View file

@ -188,7 +188,7 @@ void EditorFileSystem::_scan_filesystem() {
String project = ProjectSettings::get_singleton()->get_resource_path(); String project = ProjectSettings::get_singleton()->get_resource_path();
String fscache = EditorSettings::get_singleton()->get_project_settings_path().plus_file("filesystem_cache3"); String fscache = EditorSettings::get_singleton()->get_project_settings_dir().plus_file("filesystem_cache3");
FileAccess *f = FileAccess::open(fscache, FileAccess::READ); FileAccess *f = FileAccess::open(fscache, FileAccess::READ);
if (f) { if (f) {
@ -238,7 +238,7 @@ void EditorFileSystem::_scan_filesystem() {
memdelete(f); memdelete(f);
} }
String update_cache = EditorSettings::get_singleton()->get_project_settings_path().plus_file("filesystem_update3"); String update_cache = EditorSettings::get_singleton()->get_project_settings_dir().plus_file("filesystem_update3");
if (FileAccess::exists(update_cache)) { if (FileAccess::exists(update_cache)) {
{ {
@ -282,7 +282,7 @@ void EditorFileSystem::_scan_filesystem() {
} }
void EditorFileSystem::_save_filesystem_cache() { void EditorFileSystem::_save_filesystem_cache() {
String fscache = EditorSettings::get_singleton()->get_project_settings_path().plus_file("filesystem_cache3"); String fscache = EditorSettings::get_singleton()->get_project_settings_dir().plus_file("filesystem_cache3");
FileAccess *f = FileAccess::open(fscache, FileAccess::WRITE); FileAccess *f = FileAccess::open(fscache, FileAccess::WRITE);
_save_filesystem_cache(filesystem, f); _save_filesystem_cache(filesystem, f);
@ -1180,7 +1180,7 @@ EditorFileSystemDirectory *EditorFileSystem::get_filesystem_path(const String &p
void EditorFileSystem::_save_late_updated_files() { void EditorFileSystem::_save_late_updated_files() {
//files that already existed, and were modified, need re-scanning for dependencies upon project restart. This is done via saving this special file //files that already existed, and were modified, need re-scanning for dependencies upon project restart. This is done via saving this special file
String fscache = EditorSettings::get_singleton()->get_project_settings_path().plus_file("filesystem_update3"); String fscache = EditorSettings::get_singleton()->get_project_settings_dir().plus_file("filesystem_update3");
FileAccessRef f = FileAccess::open(fscache, FileAccess::WRITE); FileAccessRef f = FileAccess::open(fscache, FileAccess::WRITE);
for (Set<String>::Element *E = late_update_files.front(); E; E = E->next()) { for (Set<String>::Element *E = late_update_files.front(); E; E = E->next()) {
f->store_line(E->get()); f->store_line(E->get());

View file

@ -705,7 +705,7 @@ void EditorNode::_get_scene_metadata(const String &p_file) {
if (!scene) if (!scene)
return; return;
String path = EditorSettings::get_singleton()->get_project_settings_path().plus_file(p_file.get_file() + "-editstate-" + p_file.md5_text() + ".cfg"); String path = EditorSettings::get_singleton()->get_project_settings_dir().plus_file(p_file.get_file() + "-editstate-" + p_file.md5_text() + ".cfg");
Ref<ConfigFile> cf; Ref<ConfigFile> cf;
cf.instance(); cf.instance();
@ -739,7 +739,7 @@ void EditorNode::_set_scene_metadata(const String &p_file, int p_idx) {
scene->set_meta("__editor_run_settings__", Variant()); //clear it (no point in keeping it) scene->set_meta("__editor_run_settings__", Variant()); //clear it (no point in keeping it)
scene->set_meta("__editor_plugin_states__", Variant()); scene->set_meta("__editor_plugin_states__", Variant());
String path = EditorSettings::get_singleton()->get_project_settings_path().plus_file(p_file.get_file() + "-editstate-" + p_file.md5_text() + ".cfg"); String path = EditorSettings::get_singleton()->get_project_settings_dir().plus_file(p_file.get_file() + "-editstate-" + p_file.md5_text() + ".cfg");
Ref<ConfigFile> cf; Ref<ConfigFile> cf;
cf.instance(); cf.instance();
@ -926,7 +926,7 @@ void EditorNode::_save_scene_with_preview(String p_file, int p_idx) {
img->flip_y(); img->flip_y();
//save thumbnail directly, as thumbnailer may not update due to actual scene not changing md5 //save thumbnail directly, as thumbnailer may not update due to actual scene not changing md5
String temp_path = EditorSettings::get_singleton()->get_settings_path().plus_file("tmp"); String temp_path = EditorSettings::get_singleton()->get_settings_dir().plus_file("tmp");
String cache_base = ProjectSettings::get_singleton()->globalize_path(p_file).md5_text(); String cache_base = ProjectSettings::get_singleton()->globalize_path(p_file).md5_text();
cache_base = temp_path.plus_file("resthumb-" + cache_base); cache_base = temp_path.plus_file("resthumb-" + cache_base);
@ -1198,7 +1198,7 @@ void EditorNode::_dialog_action(String p_file) {
Ref<ConfigFile> config; Ref<ConfigFile> config;
config.instance(); config.instance();
Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts-3.cfg")); Error err = config->load(EditorSettings::get_singleton()->get_settings_dir().plus_file("editor_layouts-3.cfg"));
if (err == ERR_CANT_OPEN) { if (err == ERR_CANT_OPEN) {
config.instance(); // new config config.instance(); // new config
@ -1209,7 +1209,7 @@ void EditorNode::_dialog_action(String p_file) {
_save_docks_to_config(config, p_file); _save_docks_to_config(config, p_file);
config->save(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts-3.cfg")); config->save(EditorSettings::get_singleton()->get_settings_dir().plus_file("editor_layouts-3.cfg"));
layout_dialog->hide(); layout_dialog->hide();
_update_layouts_menu(); _update_layouts_menu();
@ -1226,7 +1226,7 @@ void EditorNode::_dialog_action(String p_file) {
Ref<ConfigFile> config; Ref<ConfigFile> config;
config.instance(); config.instance();
Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts-3.cfg")); Error err = config->load(EditorSettings::get_singleton()->get_settings_dir().plus_file("editor_layouts-3.cfg"));
if (err != OK || !config->has_section(p_file)) { if (err != OK || !config->has_section(p_file)) {
show_warning(TTR("Layout name not found!")); show_warning(TTR("Layout name not found!"));
@ -1240,7 +1240,7 @@ void EditorNode::_dialog_action(String p_file) {
config->set_value(p_file, E->get(), Variant()); config->set_value(p_file, E->get(), Variant());
} }
config->save(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts-3.cfg")); config->save(EditorSettings::get_singleton()->get_settings_dir().plus_file("editor_layouts-3.cfg"));
layout_dialog->hide(); layout_dialog->hide();
_update_layouts_menu(); _update_layouts_menu();
@ -3581,7 +3581,7 @@ void EditorNode::_save_docks() {
_save_docks_to_config(config, "docks"); _save_docks_to_config(config, "docks");
editor_data.get_plugin_window_layout(config); editor_data.get_plugin_window_layout(config);
config->save(EditorSettings::get_singleton()->get_project_settings_path().plus_file("editor_layout.cfg")); config->save(EditorSettings::get_singleton()->get_project_settings_dir().plus_file("editor_layout.cfg"));
} }
void EditorNode::_save_docks_to_config(Ref<ConfigFile> p_layout, const String &p_section) { void EditorNode::_save_docks_to_config(Ref<ConfigFile> p_layout, const String &p_section) {
@ -3643,7 +3643,7 @@ void EditorNode::_load_docks() {
Ref<ConfigFile> config; Ref<ConfigFile> config;
config.instance(); config.instance();
Error err = config->load(EditorSettings::get_singleton()->get_project_settings_path().plus_file("editor_layout.cfg")); Error err = config->load(EditorSettings::get_singleton()->get_project_settings_dir().plus_file("editor_layout.cfg"));
if (err != OK) { if (err != OK) {
//no config //no config
if (overridden_default_layout >= 0) { if (overridden_default_layout >= 0) {
@ -3812,7 +3812,7 @@ void EditorNode::_update_layouts_menu() {
Ref<ConfigFile> config; Ref<ConfigFile> config;
config.instance(); config.instance();
Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts-3.cfg")); Error err = config->load(EditorSettings::get_singleton()->get_settings_dir().plus_file("editor_layouts-3.cfg"));
if (err != OK) { if (err != OK) {
return; //no config return; //no config
} }
@ -3860,7 +3860,7 @@ void EditorNode::_layout_menu_option(int p_id) {
Ref<ConfigFile> config; Ref<ConfigFile> config;
config.instance(); config.instance();
Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts-3.cfg")); Error err = config->load(EditorSettings::get_singleton()->get_settings_dir().plus_file("editor_layouts-3.cfg"));
if (err != OK) { if (err != OK) {
return; //no config return; //no config
} }

View file

@ -198,7 +198,7 @@ void EditorResourcePreview::_thread() {
} else { } else {
String temp_path = EditorSettings::get_singleton()->get_settings_path().plus_file("tmp"); String temp_path = EditorSettings::get_singleton()->get_settings_dir().plus_file("tmp");
String cache_base = ProjectSettings::get_singleton()->globalize_path(item.path).md5_text(); String cache_base = ProjectSettings::get_singleton()->globalize_path(item.path).md5_text();
cache_base = temp_path.plus_file("resthumb-" + cache_base); cache_base = temp_path.plus_file("resthumb-" + cache_base);

View file

@ -639,7 +639,6 @@ void EditorSettings::create() {
return; //pointless return; //pointless
DirAccess *dir = NULL; DirAccess *dir = NULL;
Variant meta;
String config_path; String config_path;
String config_dir; String config_dir;
@ -732,13 +731,13 @@ void EditorSettings::create() {
dir->change_dir("config"); dir->change_dir("config");
String pcp = ProjectSettings::get_singleton()->get_resource_path(); String project_config_dir = ProjectSettings::get_singleton()->get_resource_path();
if (pcp.ends_with("/")) if (project_config_dir.ends_with("/"))
pcp = config_path.substr(0, pcp.size() - 1); project_config_dir = config_path.substr(0, project_config_dir.size() - 1);
pcp = pcp.get_file() + "-" + pcp.md5_text(); project_config_dir = project_config_dir.get_file() + "-" + project_config_dir.md5_text();
if (dir->change_dir(pcp)) { if (dir->change_dir(project_config_dir)) {
dir->make_dir(pcp); dir->make_dir(project_config_dir);
} else { } else {
dir->change_dir(".."); dir->change_dir("..");
} }
@ -750,8 +749,6 @@ void EditorSettings::create() {
String config_file_name = "editor_settings-" + String(_MKSTR(VERSION_MAJOR)) + ".tres"; String config_file_name = "editor_settings-" + String(_MKSTR(VERSION_MAJOR)) + ".tres";
config_file_path = config_path + "/" + config_dir + "/" + config_file_name; config_file_path = config_path + "/" + config_dir + "/" + config_file_name;
String open_path = config_file_path;
if (!dir->file_exists(config_file_name)) { if (!dir->file_exists(config_file_name)) {
goto fail; goto fail;
@ -759,7 +756,7 @@ void EditorSettings::create() {
memdelete(dir); memdelete(dir);
singleton = ResourceLoader::load(open_path, "EditorSettings"); singleton = ResourceLoader::load(config_file_path, "EditorSettings");
if (singleton.is_null()) { if (singleton.is_null()) {
WARN_PRINT("Could not open config file."); WARN_PRINT("Could not open config file.");
@ -768,8 +765,8 @@ void EditorSettings::create() {
singleton->save_changed_setting = true; singleton->save_changed_setting = true;
singleton->config_file_path = config_file_path; singleton->config_file_path = config_file_path;
singleton->project_config_path = pcp; singleton->project_config_dir = project_config_dir;
singleton->settings_path = config_path + "/" + config_dir; singleton->settings_dir = config_path + "/" + config_dir;
if (OS::get_singleton()->is_stdout_verbose()) { if (OS::get_singleton()->is_stdout_verbose()) {
@ -799,7 +796,7 @@ fail:
singleton = Ref<EditorSettings>(memnew(EditorSettings)); singleton = Ref<EditorSettings>(memnew(EditorSettings));
singleton->save_changed_setting = true; singleton->save_changed_setting = true;
singleton->config_file_path = config_file_path; singleton->config_file_path = config_file_path;
singleton->settings_path = config_path + "/" + config_dir; singleton->settings_dir = config_path + "/" + config_dir;
singleton->_load_defaults(extra_config); singleton->_load_defaults(extra_config);
singleton->setup_language(); singleton->setup_language();
singleton->setup_network(); singleton->setup_network();
@ -971,19 +968,19 @@ void EditorSettings::add_property_hint(const PropertyInfo &p_hint) {
// Settings paths and saved metadata // Settings paths and saved metadata
String EditorSettings::get_settings_path() const { String EditorSettings::get_settings_dir() const {
return settings_path; return settings_dir;
} }
String EditorSettings::get_project_settings_path() const { String EditorSettings::get_project_settings_dir() const {
return get_settings_path().plus_file("config").plus_file(project_config_path); return get_settings_dir().plus_file("config").plus_file(project_config_dir);
} }
void EditorSettings::set_project_metadata(const String &p_section, const String &p_key, Variant p_data) { void EditorSettings::set_project_metadata(const String &p_section, const String &p_key, Variant p_data) {
Ref<ConfigFile> cf = memnew(ConfigFile); Ref<ConfigFile> cf = memnew(ConfigFile);
String path = get_project_settings_path().plus_file("project_metadata.cfg"); String path = get_project_settings_dir().plus_file("project_metadata.cfg");
cf->load(path); cf->load(path);
cf->set_value(p_section, p_key, p_data); cf->set_value(p_section, p_key, p_data);
cf->save(path); cf->save(path);
@ -991,7 +988,7 @@ void EditorSettings::set_project_metadata(const String &p_section, const String
Variant EditorSettings::get_project_metadata(const String &p_section, const String &p_key, Variant p_default) { Variant EditorSettings::get_project_metadata(const String &p_section, const String &p_key, Variant p_default) {
Ref<ConfigFile> cf = memnew(ConfigFile); Ref<ConfigFile> cf = memnew(ConfigFile);
String path = get_project_settings_path().plus_file("project_metadata.cfg"); String path = get_project_settings_dir().plus_file("project_metadata.cfg");
Error err = cf->load(path); Error err = cf->load(path);
if (err != OK) { if (err != OK) {
return p_default; return p_default;
@ -1002,7 +999,7 @@ Variant EditorSettings::get_project_metadata(const String &p_section, const Stri
void EditorSettings::set_favorite_dirs(const Vector<String> &p_favorites_dirs) { void EditorSettings::set_favorite_dirs(const Vector<String> &p_favorites_dirs) {
favorite_dirs = p_favorites_dirs; favorite_dirs = p_favorites_dirs;
FileAccess *f = FileAccess::open(get_project_settings_path().plus_file("favorite_dirs"), FileAccess::WRITE); FileAccess *f = FileAccess::open(get_project_settings_dir().plus_file("favorite_dirs"), FileAccess::WRITE);
if (f) { if (f) {
for (int i = 0; i < favorite_dirs.size(); i++) for (int i = 0; i < favorite_dirs.size(); i++)
f->store_line(favorite_dirs[i]); f->store_line(favorite_dirs[i]);
@ -1018,7 +1015,7 @@ Vector<String> EditorSettings::get_favorite_dirs() const {
void EditorSettings::set_recent_dirs(const Vector<String> &p_recent_dirs) { void EditorSettings::set_recent_dirs(const Vector<String> &p_recent_dirs) {
recent_dirs = p_recent_dirs; recent_dirs = p_recent_dirs;
FileAccess *f = FileAccess::open(get_project_settings_path().plus_file("recent_dirs"), FileAccess::WRITE); FileAccess *f = FileAccess::open(get_project_settings_dir().plus_file("recent_dirs"), FileAccess::WRITE);
if (f) { if (f) {
for (int i = 0; i < recent_dirs.size(); i++) for (int i = 0; i < recent_dirs.size(); i++)
f->store_line(recent_dirs[i]); f->store_line(recent_dirs[i]);
@ -1033,7 +1030,7 @@ Vector<String> EditorSettings::get_recent_dirs() const {
void EditorSettings::load_favorites() { void EditorSettings::load_favorites() {
FileAccess *f = FileAccess::open(get_project_settings_path().plus_file("favorite_dirs"), FileAccess::READ); FileAccess *f = FileAccess::open(get_project_settings_dir().plus_file("favorite_dirs"), FileAccess::READ);
if (f) { if (f) {
String line = f->get_line().strip_edges(); String line = f->get_line().strip_edges();
while (line != "") { while (line != "") {
@ -1043,7 +1040,7 @@ void EditorSettings::load_favorites() {
memdelete(f); memdelete(f);
} }
f = FileAccess::open(get_project_settings_path().plus_file("recent_dirs"), FileAccess::READ); f = FileAccess::open(get_project_settings_dir().plus_file("recent_dirs"), FileAccess::READ);
if (f) { if (f) {
String line = f->get_line().strip_edges(); String line = f->get_line().strip_edges();
while (line != "") { while (line != "") {
@ -1056,7 +1053,7 @@ void EditorSettings::load_favorites() {
void EditorSettings::list_text_editor_themes() { void EditorSettings::list_text_editor_themes() {
String themes = "Adaptive,Default"; String themes = "Adaptive,Default";
DirAccess *d = DirAccess::open(get_settings_path().plus_file("text_editor_themes")); DirAccess *d = DirAccess::open(get_settings_dir().plus_file("text_editor_themes"));
if (d) { if (d) {
d->list_dir_begin(); d->list_dir_begin();
String file = d->get_next(); String file = d->get_next();
@ -1078,7 +1075,7 @@ void EditorSettings::load_text_editor_theme() {
return; return;
} }
String theme_path = get_settings_path().plus_file("text_editor_themes").plus_file((String)get("text_editor/theme/color_theme") + ".tet"); String theme_path = get_settings_dir().plus_file("text_editor_themes").plus_file((String)get("text_editor/theme/color_theme") + ".tet");
Ref<ConfigFile> cf = memnew(ConfigFile); Ref<ConfigFile> cf = memnew(ConfigFile);
Error err = cf->load(theme_path); Error err = cf->load(theme_path);
@ -1116,9 +1113,9 @@ bool EditorSettings::import_text_editor_theme(String p_file) {
return false; return false;
} }
DirAccess *d = DirAccess::open(get_settings_path().plus_file("text_editor_themes")); DirAccess *d = DirAccess::open(get_settings_dir().plus_file("text_editor_themes"));
if (d) { if (d) {
d->copy(p_file, get_settings_path().plus_file("text_editor_themes").plus_file(p_file.get_file())); d->copy(p_file, get_settings_dir().plus_file("text_editor_themes").plus_file(p_file.get_file()));
memdelete(d); memdelete(d);
return true; return true;
} }
@ -1133,7 +1130,7 @@ bool EditorSettings::save_text_editor_theme() {
if (p_file.get_file().to_lower() == "default" || p_file.get_file().to_lower() == "adaptive") { if (p_file.get_file().to_lower() == "default" || p_file.get_file().to_lower() == "adaptive") {
return false; return false;
} }
String theme_path = get_settings_path().plus_file("text_editor_themes").plus_file(p_file + ".tet"); String theme_path = get_settings_dir().plus_file("text_editor_themes").plus_file(p_file + ".tet");
return _save_text_editor_theme(theme_path); return _save_text_editor_theme(theme_path);
} }
@ -1151,7 +1148,7 @@ bool EditorSettings::save_text_editor_theme_as(String p_file) {
list_text_editor_themes(); list_text_editor_themes();
String theme_name = p_file.substr(0, p_file.length() - 4).get_file(); String theme_name = p_file.substr(0, p_file.length() - 4).get_file();
if (p_file.get_base_dir() == get_settings_path().plus_file("text_editor_themes")) { if (p_file.get_base_dir() == get_settings_dir().plus_file("text_editor_themes")) {
_initial_set("text_editor/theme/color_theme", theme_name); _initial_set("text_editor/theme/color_theme", theme_name);
load_text_editor_theme(); load_text_editor_theme();
} }
@ -1163,7 +1160,7 @@ bool EditorSettings::save_text_editor_theme_as(String p_file) {
Vector<String> EditorSettings::get_script_templates(const String &p_extension) { Vector<String> EditorSettings::get_script_templates(const String &p_extension) {
Vector<String> templates; Vector<String> templates;
DirAccess *d = DirAccess::open(get_settings_path().plus_file("script_templates")); DirAccess *d = DirAccess::open(get_settings_dir().plus_file("script_templates"));
if (d) { if (d) {
d->list_dir_begin(); d->list_dir_begin();
String file = d->get_next(); String file = d->get_next();
@ -1285,8 +1282,8 @@ void EditorSettings::_bind_methods() {
ClassDB::bind_method(D_METHOD("property_get_revert", "name"), &EditorSettings::property_get_revert); ClassDB::bind_method(D_METHOD("property_get_revert", "name"), &EditorSettings::property_get_revert);
ClassDB::bind_method(D_METHOD("add_property_info", "info"), &EditorSettings::_add_property_info_bind); ClassDB::bind_method(D_METHOD("add_property_info", "info"), &EditorSettings::_add_property_info_bind);
ClassDB::bind_method(D_METHOD("get_settings_path"), &EditorSettings::get_settings_path); ClassDB::bind_method(D_METHOD("get_settings_dir"), &EditorSettings::get_settings_dir);
ClassDB::bind_method(D_METHOD("get_project_settings_path"), &EditorSettings::get_project_settings_path); ClassDB::bind_method(D_METHOD("get_project_settings_dir"), &EditorSettings::get_project_settings_dir);
ClassDB::bind_method(D_METHOD("set_favorite_dirs", "dirs"), &EditorSettings::set_favorite_dirs); ClassDB::bind_method(D_METHOD("set_favorite_dirs", "dirs"), &EditorSettings::set_favorite_dirs);
ClassDB::bind_method(D_METHOD("get_favorite_dirs"), &EditorSettings::get_favorite_dirs); ClassDB::bind_method(D_METHOD("get_favorite_dirs"), &EditorSettings::get_favorite_dirs);

View file

@ -147,8 +147,8 @@ public:
void set_resource_clipboard(const Ref<Resource> &p_resource) { clipboard = p_resource; } void set_resource_clipboard(const Ref<Resource> &p_resource) { clipboard = p_resource; }
Ref<Resource> get_resource_clipboard() const { return clipboard; } Ref<Resource> get_resource_clipboard() const { return clipboard; }
String get_settings_path() const; String get_settings_dir() const;
String get_project_settings_path() const; String get_project_settings_dir() const;
void set_project_metadata(const String &p_section, const String &p_key, Variant p_data); void set_project_metadata(const String &p_section, const String &p_key, Variant p_data);
Variant get_project_metadata(const String &p_section, const String &p_key, Variant p_default); Variant get_project_metadata(const String &p_section, const String &p_key, Variant p_default);

View file

@ -46,7 +46,7 @@ void ExportTemplateManager::_update_template_list() {
} }
DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
Error err = d->change_dir(EditorSettings::get_singleton()->get_settings_path().plus_file("templates")); Error err = d->change_dir(EditorSettings::get_singleton()->get_settings_dir().plus_file("templates"));
d->list_dir_begin(); d->list_dir_begin();
Set<String> templates; Set<String> templates;
@ -142,7 +142,7 @@ void ExportTemplateManager::_uninstall_template(const String &p_version) {
void ExportTemplateManager::_uninstall_template_confirm() { void ExportTemplateManager::_uninstall_template_confirm() {
DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
Error err = d->change_dir(EditorSettings::get_singleton()->get_settings_path().plus_file("templates")); Error err = d->change_dir(EditorSettings::get_singleton()->get_settings_dir().plus_file("templates"));
ERR_FAIL_COND(err != OK); ERR_FAIL_COND(err != OK);
@ -244,7 +244,7 @@ void ExportTemplateManager::_install_from_file(const String &p_file) {
return; return;
} }
String template_path = EditorSettings::get_singleton()->get_settings_path().plus_file("templates").plus_file(version); String template_path = EditorSettings::get_singleton()->get_settings_dir().plus_file("templates").plus_file(version);
DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
Error err = d->make_dir_recursive(template_path); Error err = d->make_dir_recursive(template_path);
@ -393,7 +393,7 @@ void ExportTemplateManager::_http_download_templates_completed(int p_status, int
if (p_code != 200) { if (p_code != 200) {
template_list_state->set_text(TTR("Failed:") + " " + itos(p_code)); template_list_state->set_text(TTR("Failed:") + " " + itos(p_code));
} else { } else {
String path = EditorSettings::get_singleton()->get_settings_path().plus_file("tmp").plus_file("tmp_templates.tpz"); String path = EditorSettings::get_singleton()->get_settings_dir().plus_file("tmp").plus_file("tmp_templates.tpz");
FileAccess *f = FileAccess::open(path, FileAccess::WRITE); FileAccess *f = FileAccess::open(path, FileAccess::WRITE);
if (!f) { if (!f) {
template_list_state->set_text(TTR("Can't write file.")); template_list_state->set_text(TTR("Can't write file."));

View file

@ -445,7 +445,7 @@ void EditorAssetLibraryItemDownload::_install() {
void EditorAssetLibraryItemDownload::_make_request() { void EditorAssetLibraryItemDownload::_make_request() {
download->cancel_request(); download->cancel_request();
download->set_download_file(EditorSettings::get_singleton()->get_settings_path().plus_file("tmp").plus_file("tmp_asset_" + itos(asset_id)) + ".zip"); download->set_download_file(EditorSettings::get_singleton()->get_settings_dir().plus_file("tmp").plus_file("tmp_asset_" + itos(asset_id)) + ".zip");
Error err = download->request(host); Error err = download->request(host);
if (err != OK) { if (err != OK) {
@ -680,7 +680,7 @@ void EditorAssetLibrary::_image_update(bool use_cache, bool final, const PoolByt
PoolByteArray image_data = p_data; PoolByteArray image_data = p_data;
if (use_cache) { if (use_cache) {
String cache_filename_base = EditorSettings::get_singleton()->get_settings_path().plus_file("tmp").plus_file("assetimage_" + image_queue[p_queue_id].image_url.md5_text()); String cache_filename_base = EditorSettings::get_singleton()->get_settings_dir().plus_file("tmp").plus_file("assetimage_" + image_queue[p_queue_id].image_url.md5_text());
FileAccess *file = FileAccess::open(cache_filename_base + ".data", FileAccess::READ); FileAccess *file = FileAccess::open(cache_filename_base + ".data", FileAccess::READ);
@ -738,7 +738,7 @@ void EditorAssetLibrary::_image_request_completed(int p_status, int p_code, cons
if (p_code != HTTPClient::RESPONSE_NOT_MODIFIED) { if (p_code != HTTPClient::RESPONSE_NOT_MODIFIED) {
for (int i = 0; i < headers.size(); i++) { for (int i = 0; i < headers.size(); i++) {
if (headers[i].findn("ETag:") == 0) { // Save etag if (headers[i].findn("ETag:") == 0) { // Save etag
String cache_filename_base = EditorSettings::get_singleton()->get_settings_path().plus_file("tmp").plus_file("assetimage_" + image_queue[p_queue_id].image_url.md5_text()); String cache_filename_base = EditorSettings::get_singleton()->get_settings_dir().plus_file("tmp").plus_file("assetimage_" + image_queue[p_queue_id].image_url.md5_text());
String new_etag = headers[i].substr(headers[i].find(":") + 1, headers[i].length()).strip_edges(); String new_etag = headers[i].substr(headers[i].find(":") + 1, headers[i].length()).strip_edges();
FileAccess *file; FileAccess *file;
@ -786,7 +786,7 @@ void EditorAssetLibrary::_update_image_queue() {
for (Map<int, ImageQueue>::Element *E = image_queue.front(); E; E = E->next()) { for (Map<int, ImageQueue>::Element *E = image_queue.front(); E; E = E->next()) {
if (!E->get().active && current_images < max_images) { if (!E->get().active && current_images < max_images) {
String cache_filename_base = EditorSettings::get_singleton()->get_settings_path().plus_file("tmp").plus_file("assetimage_" + E->get().image_url.md5_text()); String cache_filename_base = EditorSettings::get_singleton()->get_settings_dir().plus_file("tmp").plus_file("assetimage_" + E->get().image_url.md5_text());
Vector<String> headers; Vector<String> headers;
if (FileAccess::exists(cache_filename_base + ".etag") && FileAccess::exists(cache_filename_base + ".data")) { if (FileAccess::exists(cache_filename_base + ".etag") && FileAccess::exists(cache_filename_base + ".data")) {

View file

@ -184,7 +184,7 @@ Ref<Texture> EditorPackedScenePreviewPlugin::generate(const RES &p_from) {
Ref<Texture> EditorPackedScenePreviewPlugin::generate_from_path(const String &p_path) { Ref<Texture> EditorPackedScenePreviewPlugin::generate_from_path(const String &p_path) {
String temp_path = EditorSettings::get_singleton()->get_settings_path().plus_file("tmp"); String temp_path = EditorSettings::get_singleton()->get_settings_dir().plus_file("tmp");
String cache_base = ProjectSettings::get_singleton()->globalize_path(p_path).md5_text(); String cache_base = ProjectSettings::get_singleton()->globalize_path(p_path).md5_text();
cache_base = temp_path.plus_file("resthumb-" + cache_base); cache_base = temp_path.plus_file("resthumb-" + cache_base);

View file

@ -855,7 +855,7 @@ void ScriptEditor::_menu_option(int p_option) {
file_dialog_option = FILE_SAVE_THEME_AS; file_dialog_option = FILE_SAVE_THEME_AS;
file_dialog->clear_filters(); file_dialog->clear_filters();
file_dialog->add_filter("*.tet"); file_dialog->add_filter("*.tet");
file_dialog->set_current_path(EditorSettings::get_singleton()->get_settings_path() + "/text_editor_themes/" + EditorSettings::get_singleton()->get("text_editor/theme/color_theme")); file_dialog->set_current_path(EditorSettings::get_singleton()->get_settings_dir() + "/text_editor_themes/" + EditorSettings::get_singleton()->get("text_editor/theme/color_theme"));
file_dialog->popup_centered_ratio(); file_dialog->popup_centered_ratio();
file_dialog->set_title(TTR("Save Theme As..")); file_dialog->set_title(TTR("Save Theme As.."));
} break; } break;

View file

@ -62,7 +62,7 @@ static void _compress_image(Image::CompressMode p_mode, Image *p_image) {
} }
return; return;
} }
String spath = EditorSettings::get_singleton()->get_settings_path(); String spath = EditorSettings::get_singleton()->get_settings_dir();
List<String> args; List<String> args;

View file

@ -128,7 +128,7 @@ void ScriptCreateDialog::_template_changed(int p_template) {
} }
String ext = ScriptServer::get_language(language_menu->get_selected())->get_extension(); String ext = ScriptServer::get_language(language_menu->get_selected())->get_extension();
String name = template_list[p_template - 1] + "." + ext; String name = template_list[p_template - 1] + "." + ext;
script_template = EditorSettings::get_singleton()->get_settings_path() + "/script_templates/" + name; script_template = EditorSettings::get_singleton()->get_settings_dir() + "/script_templates/" + name;
} }
void ScriptCreateDialog::ok_pressed() { void ScriptCreateDialog::ok_pressed() {

View file

@ -57,7 +57,7 @@ String _get_expected_build_config() {
String _get_mono_user_dir() { String _get_mono_user_dir() {
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
if (EditorSettings::get_singleton()) { if (EditorSettings::get_singleton()) {
return EditorSettings::get_singleton()->get_settings_path().plus_file("mono"); return EditorSettings::get_singleton()->get_settings_dir().plus_file("mono");
} else { } else {
String settings_path; String settings_path;

View file

@ -1066,7 +1066,7 @@ public:
if (use_reverse) if (use_reverse)
p_debug_flags |= DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST; p_debug_flags |= DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST;
String export_to = EditorSettings::get_singleton()->get_settings_path() + "/tmp/tmpexport.apk"; String export_to = EditorSettings::get_singleton()->get_settings_dir() + "/tmp/tmpexport.apk";
Error err = export_project(p_preset, true, export_to, p_debug_flags); Error err = export_project(p_preset, true, export_to, p_debug_flags);
if (err) { if (err) {
device_lock->unlock(); device_lock->unlock();
@ -1291,7 +1291,7 @@ public:
zlib_filefunc_def io2 = io; zlib_filefunc_def io2 = io;
FileAccess *dst_f = NULL; FileAccess *dst_f = NULL;
io2.opaque = &dst_f; io2.opaque = &dst_f;
String unaligned_path = EditorSettings::get_singleton()->get_settings_path() + "/tmp/tmpexport-unaligned.apk"; String unaligned_path = EditorSettings::get_singleton()->get_settings_dir() + "/tmp/tmpexport-unaligned.apk";
zipFile unaligned_apk = zipOpen2(unaligned_path.utf8().get_data(), APPEND_STATUS_CREATE, NULL, &io2); zipFile unaligned_apk = zipOpen2(unaligned_path.utf8().get_data(), APPEND_STATUS_CREATE, NULL, &io2);
bool export_x86 = p_preset->get("architecture/x86"); bool export_x86 = p_preset->get("architecture/x86");

View file

@ -319,7 +319,7 @@ int EditorExportPlatformJavaScript::get_device_count() const {
Error EditorExportPlatformJavaScript::run(const Ref<EditorExportPreset> &p_preset, int p_device, int p_debug_flags) { Error EditorExportPlatformJavaScript::run(const Ref<EditorExportPreset> &p_preset, int p_device, int p_debug_flags) {
String path = EditorSettings::get_singleton()->get_settings_path() + "/tmp/tmp_export.html"; String path = EditorSettings::get_singleton()->get_settings_dir() + "/tmp/tmp_export.html";
Error err = export_project(p_preset, true, path, p_debug_flags); Error err = export_project(p_preset, true, path, p_debug_flags);
if (err) { if (err) {
return err; return err;

View file

@ -160,7 +160,7 @@ void EditorExportPlatformOSX::_make_icon(const Ref<Image> &p_icon, Vector<uint8_
copy->convert(Image::FORMAT_RGBA8); copy->convert(Image::FORMAT_RGBA8);
copy->resize(size, size); copy->resize(size, size);
it->create_from_image(copy); it->create_from_image(copy);
String path = EditorSettings::get_singleton()->get_settings_path() + "/tmp/icon.png"; String path = EditorSettings::get_singleton()->get_settings_dir() + "/tmp/icon.png";
ResourceSaver::save(path, it); ResourceSaver::save(path, it);
FileAccess *f = FileAccess::open(path, FileAccess::READ); FileAccess *f = FileAccess::open(path, FileAccess::READ);
@ -344,7 +344,7 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
if (use_dmg()) { if (use_dmg()) {
// We're on OSX so we can export to DMG, but first we create our application bundle // We're on OSX so we can export to DMG, but first we create our application bundle
tmp_app_path_name = EditorSettings::get_singleton()->get_settings_path() + "/tmp/" + pkg_name + ".app"; tmp_app_path_name = EditorSettings::get_singleton()->get_settings_dir() + "/tmp/" + pkg_name + ".app";
print_line("Exporting to " + tmp_app_path_name); print_line("Exporting to " + tmp_app_path_name);
DirAccess *tmp_app_path = DirAccess::create_for_path(tmp_app_path_name); DirAccess *tmp_app_path = DirAccess::create_for_path(tmp_app_path_name);
if (!tmp_app_path) { if (!tmp_app_path) {
@ -539,7 +539,7 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
OS::get_singleton()->move_to_trash(tmp_app_path_name); OS::get_singleton()->move_to_trash(tmp_app_path_name);
} else { } else {
String pack_path = EditorSettings::get_singleton()->get_settings_path() + "/tmp/" + pkg_name + ".pck"; String pack_path = EditorSettings::get_singleton()->get_settings_dir() + "/tmp/" + pkg_name + ".pck";
Error err = save_pack(p_preset, pack_path); Error err = save_pack(p_preset, pack_path);
if (err == OK) { if (err == OK) {

View file

@ -456,8 +456,8 @@ void AppxPackager::init(FileAccess *p_fa) {
package = p_fa; package = p_fa;
central_dir_offset = 0; central_dir_offset = 0;
end_of_central_dir_offset = 0; end_of_central_dir_offset = 0;
tmp_blockmap_file_path = EditorSettings::get_singleton()->get_settings_path() + "/tmp/tmpblockmap.xml"; tmp_blockmap_file_path = EditorSettings::get_singleton()->get_settings_dir() + "/tmp/tmpblockmap.xml";
tmp_content_types_file_path = EditorSettings::get_singleton()->get_settings_path() + "/tmp/tmpcontenttypes.xml"; tmp_content_types_file_path = EditorSettings::get_singleton()->get_settings_dir() + "/tmp/tmpcontenttypes.xml";
} }
void AppxPackager::add_file(String p_file_name, const uint8_t *p_buffer, size_t p_len, int p_file_no, int p_total_files, bool p_compress) { void AppxPackager::add_file(String p_file_name, const uint8_t *p_buffer, size_t p_len, int p_file_no, int p_total_files, bool p_compress) {
@ -886,7 +886,7 @@ class EditorExportUWP : public EditorExportPlatform {
if (!image) return data; if (!image) return data;
String tmp_path = EditorSettings::get_singleton()->get_settings_path().plus_file("tmp/uwp_tmp_logo.png"); String tmp_path = EditorSettings::get_singleton()->get_settings_dir().plus_file("tmp/uwp_tmp_logo.png");
Error err = image->get_data()->save_png(tmp_path); Error err = image->get_data()->save_png(tmp_path);