diff options
author | fabriceci <fabricecipolla@gmail.com> | 2021-10-11 11:30:59 +0200 |
---|---|---|
committer | jmb462 <jmb462@gmail.com> | 2022-01-02 21:52:09 +0100 |
commit | 9d5b80705912d85c3c7301ac0ea0afbf9372a660 (patch) | |
tree | e9528ac06fcfc29bc43846713d1c3ddb94becc22 /editor/editor_settings.cpp | |
parent | 28174d531b7128f0281fc2b88da2f4962fd3513e (diff) |
Improve editor template workflow
Co-Authored-By: jmb462 <jmb462@gmail.com>
Diffstat (limited to 'editor/editor_settings.cpp')
-rw-r--r-- | editor/editor_settings.cpp | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 1ac1d6f048..fabf497d9c 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -781,43 +781,6 @@ bool EditorSettings::_is_default_text_editor_theme(String p_theme_name) { return p_theme_name == "default" || p_theme_name == "godot 2" || p_theme_name == "custom"; } -static Dictionary _get_builtin_script_templates() { - Dictionary templates; - - // No Comments - templates["no_comments.gd"] = - "extends %BASE%\n" - "\n" - "\n" - "func _ready()%VOID_RETURN%:\n" - "%TS%pass\n"; - - // Empty - templates["empty.gd"] = - "extends %BASE%" - "\n" - "\n"; - - return templates; -} - -static void _create_script_templates(const String &p_path) { - Dictionary templates = _get_builtin_script_templates(); - List<Variant> keys; - templates.get_key_list(&keys); - FileAccessRef file = FileAccess::create(FileAccess::ACCESS_FILESYSTEM); - DirAccessRef dir = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); - dir->change_dir(p_path); - for (int i = 0; i < keys.size(); i++) { - if (!dir->file_exists(keys[i])) { - Error err = file->reopen(p_path.plus_file((String)keys[i]), FileAccess::WRITE); - ERR_FAIL_COND(err != OK); - file->store_string(templates[keys[i]]); - file->close(); - } - } -} - // PUBLIC METHODS EditorSettings *EditorSettings::get_singleton() { @@ -852,10 +815,7 @@ void EditorSettings::create() { } if (EditorPaths::get_singleton()->are_paths_valid()) { - _create_script_templates(EditorPaths::get_singleton()->get_config_dir().plus_file("script_templates")); - // Validate editor config file. - DirAccessRef dir = DirAccess::open(EditorPaths::get_singleton()->get_config_dir()); String config_file_name = "editor_settings-" + itos(VERSION_MAJOR) + ".tres"; config_file_path = EditorPaths::get_singleton()->get_config_dir().plus_file(config_file_name); |