diff options
| author | Pedro J. Estébanez | 2017-07-26 15:28:54 +0200 |
|---|---|---|
| committer | Pedro J. Estébanez | 2017-07-26 16:13:38 +0200 |
| commit | 1619aabfe1bd1ab04b1e14679698c2765d86c1e8 (patch) | |
| tree | a15dc1edd418468359aee9ba025b5b4bd02f980a /editor/project_manager.cpp | |
| parent | ccb17c2b279ec0dc6160f8d01d381b05e4c81fd3 (diff) | |
| download | godot-1619aabfe1bd1ab04b1e14679698c2765d86c1e8.tar.gz godot-1619aabfe1bd1ab04b1e14679698c2765d86c1e8.tar.zst godot-1619aabfe1bd1ab04b1e14679698c2765d86c1e8.zip | |
Fix mutating project.godot
Namely:
- comment block lost on first save;
- config_version doubled as 3 and null on second save;
- format change on first save.
Diffstat (limited to '')
| -rw-r--r-- | editor/project_manager.cpp | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index acf5fe02c..82f17b80d 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -187,30 +187,17 @@ private: } else { if (mode == MODE_NEW) { - FileAccess *f = FileAccess::open(dir.plus_file("/project.godot"), FileAccess::WRITE); - if (!f) { + ProjectSettings::CustomMap initial_settings; + initial_settings["application/config/name"] = project_name->get_text(); + initial_settings["application/config/icon"] = "res://icon.png"; + initial_settings["rendering/environment/default_environment"] = "res://default_env.tres"; + + if (ProjectSettings::get_singleton()->save_custom(dir.plus_file("/project.godot"), initial_settings, Vector<String>(), false)) { error->set_text(TTR("Couldn't create project.godot in project path.")); } else { - - f->store_line("; Engine configuration file."); - f->store_line("; It's best edited using the editor UI and not directly,"); - f->store_line("; since the parameters that go here are not all obvious."); - f->store_line("; "); - f->store_line("; Format: "); - f->store_line("; [section] ; section goes between []"); - f->store_line("; param=value ; assign values to parameters"); - f->store_line("\n"); - f->store_line("[application]"); - f->store_line("\n"); - f->store_line("config/name=\"" + project_name->get_text() + "\""); - f->store_line("config/icon=\"res://icon.png\""); - f->store_line("[rendering]"); - f->store_line("environment/default_environment=\"res://default_env.tres\""); - memdelete(f); - ResourceSaver::save(dir.plus_file("/icon.png"), get_icon("DefaultProjectIcon", "EditorIcons")); - f = FileAccess::open(dir.plus_file("/default_env.tres"), FileAccess::WRITE); + FileAccess *f = FileAccess::open(dir.plus_file("/default_env.tres"), FileAccess::WRITE); if (!f) { error->set_text(TTR("Couldn't create project.godot in project path.")); } else { |
