| 3572 | } |
| 3573 | |
| 3574 | void ScriptEditor::set_window_layout(Ref<ConfigFile> p_layout) { |
| 3575 | if (!bool(EDITOR_GET("text_editor/behavior/files/restore_scripts_on_load"))) { |
| 3576 | return; |
| 3577 | } |
| 3578 | |
| 3579 | if (!p_layout->has_section_key("ScriptEditor", "open_scripts") && !p_layout->has_section_key("ScriptEditor", "open_help")) { |
| 3580 | return; |
| 3581 | } |
| 3582 | |
| 3583 | Array scripts = p_layout->get_value("ScriptEditor", "open_scripts"); |
| 3584 | Array helps; |
| 3585 | if (p_layout->has_section_key("ScriptEditor", "open_help")) { |
| 3586 | helps = p_layout->get_value("ScriptEditor", "open_help"); |
| 3587 | } |
| 3588 | |
| 3589 | restoring_layout = true; |
| 3590 | |
| 3591 | bool use_external_editor = bool(EDITOR_GET("text_editor/external/use_external_editor")); |
| 3592 | bool prefer_tabs = bool(EDITOR_GET("text_editor/external/prefer_tabs_in_external_editor")); |
| 3593 | Vector<String> external_scripts; |
| 3594 | |
| 3595 | HashSet<String> loaded_scripts; |
| 3596 | List<String> extensions; |
| 3597 | ResourceLoader::get_recognized_extensions_for_type("Script", &extensions); |
| 3598 | ResourceLoader::get_recognized_extensions_for_type("JSON", &extensions); |
| 3599 | |
| 3600 | for (int i = 0; i < scripts.size(); i++) { |
| 3601 | String path = scripts[i]; |
| 3602 | |
| 3603 | Dictionary script_info = scripts[i]; |
| 3604 | if (!script_info.is_empty()) { |
| 3605 | path = script_info["path"]; |
| 3606 | } |
| 3607 | |
| 3608 | if (!FileAccess::exists(path)) { |
| 3609 | if (script_editor_cache->has_section(path)) { |
| 3610 | script_editor_cache->erase_section(path); |
| 3611 | } |
| 3612 | continue; |
| 3613 | } |
| 3614 | |
| 3615 | if (use_external_editor && prefer_tabs) { |
| 3616 | external_scripts.push_back(ProjectSettings::get_singleton()->globalize_path(path)); |
| 3617 | } |
| 3618 | |
| 3619 | loaded_scripts.insert(path); |
| 3620 | |
| 3621 | if (extensions.find(path.get_extension())) { |
| 3622 | Ref<Resource> scr = ResourceLoader::load(path); |
| 3623 | if (scr.is_null()) { |
| 3624 | continue; |
| 3625 | } |
| 3626 | if (!edit(scr, false)) { |
| 3627 | continue; |
| 3628 | } |
| 3629 | } else { |
| 3630 | Error error; |
| 3631 | Ref<TextFile> text_file = _load_text_file(path, &error); |
nothing calls this directly
no test coverage detected