Merge pull request #60709 from bruvzg/fix_txt_res_dep_rename
This commit is contained in:
commit
647a202513
@ -1287,6 +1287,7 @@ Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path, cons
|
|||||||
fw->store_8(b);
|
fw->store_8(b);
|
||||||
b = f->get_8();
|
b = f->get_8();
|
||||||
}
|
}
|
||||||
|
f.unref();
|
||||||
|
|
||||||
bool all_ok = fw->get_error() == OK;
|
bool all_ok = fw->get_error() == OK;
|
||||||
|
|
||||||
|
@ -890,7 +890,6 @@ Error ResourceLoaderText::rename_dependencies(Ref<FileAccess> p_f, const String
|
|||||||
fw->store_8(c);
|
fw->store_8(c);
|
||||||
c = f->get_8();
|
c = f->get_8();
|
||||||
}
|
}
|
||||||
f.unref();
|
|
||||||
|
|
||||||
bool all_ok = fw->get_error() == OK;
|
bool all_ok = fw->get_error() == OK;
|
||||||
|
|
||||||
@ -898,12 +897,6 @@ Error ResourceLoaderText::rename_dependencies(Ref<FileAccess> p_f, const String
|
|||||||
return ERR_CANT_CREATE;
|
return ERR_CANT_CREATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
fw.unref();
|
|
||||||
|
|
||||||
Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
|
|
||||||
da->remove(p_path);
|
|
||||||
da->rename(p_path + ".depren", p_path);
|
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1439,15 +1432,26 @@ void ResourceFormatLoaderText::get_dependencies(const String &p_path, List<Strin
|
|||||||
}
|
}
|
||||||
|
|
||||||
Error ResourceFormatLoaderText::rename_dependencies(const String &p_path, const Map<String, String> &p_map) {
|
Error ResourceFormatLoaderText::rename_dependencies(const String &p_path, const Map<String, String> &p_map) {
|
||||||
Ref<FileAccess> f = FileAccess::open(p_path, FileAccess::READ);
|
Error err = OK;
|
||||||
if (f.is_null()) {
|
{
|
||||||
ERR_FAIL_V(ERR_CANT_OPEN);
|
Ref<FileAccess> f = FileAccess::open(p_path, FileAccess::READ);
|
||||||
|
if (f.is_null()) {
|
||||||
|
ERR_FAIL_V(ERR_CANT_OPEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
ResourceLoaderText loader;
|
||||||
|
loader.local_path = ProjectSettings::get_singleton()->localize_path(p_path);
|
||||||
|
loader.res_path = loader.local_path;
|
||||||
|
err = loader.rename_dependencies(f, p_path, p_map);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourceLoaderText loader;
|
if (err == OK) {
|
||||||
loader.local_path = ProjectSettings::get_singleton()->localize_path(p_path);
|
Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
|
||||||
loader.res_path = loader.local_path;
|
da->remove(p_path);
|
||||||
return loader.rename_dependencies(f, p_path, p_map);
|
da->rename(p_path + ".depren", p_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourceFormatLoaderText *ResourceFormatLoaderText::singleton = nullptr;
|
ResourceFormatLoaderText *ResourceFormatLoaderText::singleton = nullptr;
|
||||||
|
Loading…
Reference in New Issue
Block a user