summaryrefslogtreecommitdiff
path: root/Source/Core/Common/FileUtil.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2016-06-30 10:58:50 +0200
committerJosJuice <josjuice@gmail.com>2016-06-30 11:49:13 +0200
commited42467e87c7abb15f722228a50a28e3f184ea97 (patch)
tree636560df7a37b075dd9296cb51166c5cf2ee6b7a /Source/Core/Common/FileUtil.cpp
parent10682dbf5843bcf55cda7db4bc4e5acaee556648 (diff)
Fall back to default theme when the configured theme doesn't exist
Diffstat (limited to 'Source/Core/Common/FileUtil.cpp')
-rw-r--r--Source/Core/Common/FileUtil.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/Source/Core/Common/FileUtil.cpp b/Source/Core/Common/FileUtil.cpp
index 8317550297..564ab58d8f 100644
--- a/Source/Core/Common/FileUtil.cpp
+++ b/Source/Core/Common/FileUtil.cpp
@@ -866,12 +866,16 @@ void SetUserPath(unsigned int dir_index, const std::string& path)
std::string GetThemeDir(const std::string& theme_name)
{
std::string dir = File::GetUserPath(D_THEMES_IDX) + theme_name + "/";
+ if (File::Exists(dir))
+ return dir;
- // If theme does not exist in user's dir load from shared directory
- if (!File::Exists(dir))
- dir = GetSysDirectory() + THEMES_DIR "/" + theme_name + "/";
+ // If the theme doesn't exist in the user dir, load from shared directory
+ dir = GetSysDirectory() + THEMES_DIR "/" + theme_name + "/";
+ if (File::Exists(dir))
+ return dir;
- return dir;
+ // If the theme doesn't exist at all, load the default theme
+ return GetSysDirectory() + THEMES_DIR "/" DEFAULT_THEME_DIR "/";
}
bool WriteStringToFile(const std::string& str, const std::string& filename)