summaryrefslogtreecommitdiff
path: root/core/io
diff options
context:
space:
mode:
Diffstat (limited to 'core/io')
-rw-r--r--core/io/resource_importer.cpp2
-rw-r--r--core/io/resource_uid.cpp17
-rw-r--r--core/io/resource_uid.h2
3 files changed, 13 insertions, 8 deletions
diff --git a/core/io/resource_importer.cpp b/core/io/resource_importer.cpp
index 1e166015b0..cd44c537a8 100644
--- a/core/io/resource_importer.cpp
+++ b/core/io/resource_importer.cpp
@@ -418,7 +418,7 @@ Ref<ResourceImporter> ResourceFormatImporter::get_importer_by_extension(const St
}
String ResourceFormatImporter::get_import_base_path(const String &p_for_file) const {
- return ProjectSettings::IMPORTED_FILES_PATH.plus_file(p_for_file.get_file() + "-" + p_for_file.md5_text());
+ return ProjectSettings::get_singleton()->get_imported_files_path().plus_file(p_for_file.get_file() + "-" + p_for_file.md5_text());
}
bool ResourceFormatImporter::are_import_settings_valid(const String &p_path) const {
diff --git a/core/io/resource_uid.cpp b/core/io/resource_uid.cpp
index 97d683f415..acb49ecece 100644
--- a/core/io/resource_uid.cpp
+++ b/core/io/resource_uid.cpp
@@ -29,6 +29,8 @@
/*************************************************************************/
#include "resource_uid.h"
+
+#include "core/config/project_settings.h"
#include "core/crypto/crypto.h"
#include "core/io/dir_access.h"
#include "core/io/file_access.h"
@@ -36,7 +38,9 @@
static constexpr uint32_t char_count = ('z' - 'a');
static constexpr uint32_t base = char_count + ('9' - '0');
-const char *ResourceUID::CACHE_FILE = "res://.godot/uid_cache.bin";
+String ResourceUID::get_cache_file() {
+ return ProjectSettings::get_singleton()->get_project_data_path().plus_file("uid_cache.bin");
+}
String ResourceUID::id_to_text(ID p_id) const {
if (p_id < 0) {
@@ -136,12 +140,13 @@ void ResourceUID::remove_id(ID p_id) {
}
Error ResourceUID::save_to_cache() {
- if (!FileAccess::exists(CACHE_FILE)) {
+ String cache_file = get_cache_file();
+ if (!FileAccess::exists(cache_file)) {
DirAccessRef d = DirAccess::create(DirAccess::ACCESS_RESOURCES);
- d->make_dir_recursive(String(CACHE_FILE).get_base_dir()); //ensure base dir exists
+ d->make_dir_recursive(String(cache_file).get_base_dir()); //ensure base dir exists
}
- FileAccessRef f = FileAccess::open(CACHE_FILE, FileAccess::WRITE);
+ FileAccessRef f = FileAccess::open(cache_file, FileAccess::WRITE);
if (!f) {
return ERR_CANT_OPEN;
}
@@ -165,7 +170,7 @@ Error ResourceUID::save_to_cache() {
}
Error ResourceUID::load_from_cache() {
- FileAccessRef f = FileAccess::open(CACHE_FILE, FileAccess::READ);
+ FileAccessRef f = FileAccess::open(get_cache_file(), FileAccess::READ);
if (!f) {
return ERR_CANT_OPEN;
}
@@ -207,7 +212,7 @@ Error ResourceUID::update_cache() {
for (OrderedHashMap<ID, Cache>::Element E = unique_ids.front(); E; E = E.next()) {
if (!E.get().saved_to_cache) {
if (f == nullptr) {
- f = FileAccess::open(CACHE_FILE, FileAccess::READ_WRITE); //append
+ f = FileAccess::open(get_cache_file(), FileAccess::READ_WRITE); //append
if (!f) {
return ERR_CANT_OPEN;
}
diff --git a/core/io/resource_uid.h b/core/io/resource_uid.h
index b12138425a..2f1bfdf243 100644
--- a/core/io/resource_uid.h
+++ b/core/io/resource_uid.h
@@ -44,7 +44,7 @@ public:
INVALID_ID = -1
};
- static const char *CACHE_FILE;
+ static String get_cache_file();
private:
mutable Ref<Crypto> crypto;