summaryrefslogtreecommitdiff
path: root/platform/linuxbsd/os_linuxbsd.cpp
diff options
context:
space:
mode:
authordzil123 <5725958+dzil123@users.noreply.github.com>2022-11-12 22:38:32 -0800
committerdzil123 <5725958+dzil123@users.noreply.github.com>2022-11-12 22:38:32 -0800
commitd22ab7c85b3f3cef54122d913043dbe0b4e16ed9 (patch)
treedae40f5fe65dd1014c9ed6a2a1a62fd3d8b6773a /platform/linuxbsd/os_linuxbsd.cpp
parentc17f17eb98188a7134c85bdbdf0123127c462046 (diff)
Cache OS_LinuxBSD::get_system_dir(SYSTEM_DIR_DESKTOP)
Diffstat (limited to 'platform/linuxbsd/os_linuxbsd.cpp')
-rw-r--r--platform/linuxbsd/os_linuxbsd.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/platform/linuxbsd/os_linuxbsd.cpp b/platform/linuxbsd/os_linuxbsd.cpp
index 22c5f063c3..81cadea51f 100644
--- a/platform/linuxbsd/os_linuxbsd.cpp
+++ b/platform/linuxbsd/os_linuxbsd.cpp
@@ -128,6 +128,8 @@ void OS_LinuxBSD::initialize() {
crash_handler.initialize();
OS_Unix::initialize_core();
+
+ system_dir_desktop_cache = get_system_dir(SYSTEM_DIR_DESKTOP);
}
void OS_LinuxBSD::initialize_joypads() {
@@ -719,6 +721,10 @@ String OS_LinuxBSD::get_cache_path() const {
}
String OS_LinuxBSD::get_system_dir(SystemDir p_dir, bool p_shared_storage) const {
+ if (p_dir == SYSTEM_DIR_DESKTOP && !system_dir_desktop_cache.is_empty()) {
+ return system_dir_desktop_cache;
+ }
+
String xdgparam;
switch (p_dir) {
@@ -727,31 +733,24 @@ String OS_LinuxBSD::get_system_dir(SystemDir p_dir, bool p_shared_storage) const
} break;
case SYSTEM_DIR_DCIM: {
xdgparam = "PICTURES";
-
} break;
case SYSTEM_DIR_DOCUMENTS: {
xdgparam = "DOCUMENTS";
-
} break;
case SYSTEM_DIR_DOWNLOADS: {
xdgparam = "DOWNLOAD";
-
} break;
case SYSTEM_DIR_MOVIES: {
xdgparam = "VIDEOS";
-
} break;
case SYSTEM_DIR_MUSIC: {
xdgparam = "MUSIC";
-
} break;
case SYSTEM_DIR_PICTURES: {
xdgparam = "PICTURES";
-
} break;
case SYSTEM_DIR_RINGTONES: {
xdgparam = "MUSIC";
-
} break;
}