MCPcopy Create free account
hub / github.com/GDRETools/gdsdecomp / load_pack_gdscript_cache

Method load_pack_gdscript_cache

utility/gdre_settings.cpp:2063–2095  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2061}
2062
2063Error GDRESettings::load_pack_gdscript_cache(bool p_reset) {
2064 if (!is_pack_loaded()) {
2065 return ERR_UNAVAILABLE;
2066 }
2067 if (p_reset) {
2068 reset_gdscript_cache();
2069 }
2070
2071 auto cache_file = get_loaded_pack_data_dir().path_join("global_script_class_cache.cfg");
2072 if (!FileAccess::exists(cache_file)) {
2073 return ERR_FILE_NOT_FOUND;
2074 }
2075 Array global_class_list;
2076 Ref<ConfigFileCompat> cf;
2077 cf.instantiate();
2078 if (cf->load(cache_file) == OK) {
2079 // the script cache file has a single key, "list", which is an array of dictionaries
2080 global_class_list = cf->get_value("", "list", Array());
2081 } else {
2082 return ERR_FILE_CANT_READ;
2083 }
2084
2085 for (int i = 0; i < global_class_list.size(); i++) {
2086 Dictionary d = global_class_list[i];
2087 if (d.is_empty() || !d.has("path")) {
2088 continue;
2089 }
2090 String path = d["path"];
2091 // path = path.simplify_path();
2092 script_cache[path] = d;
2093 }
2094 return OK;
2095}
2096namespace {
2097struct ScriptCacheTask {
2098 struct ScriptCacheTaskToken {

Callers

nothing calls this directly

Calls 3

loadMethod · 0.45
get_valueMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected