diff options
| author | Matthew Parlane <parlane@gmail.com> | 2013-04-11 19:55:36 +1200 |
|---|---|---|
| committer | Matthew Parlane <parlane@gmail.com> | 2013-04-11 19:55:36 +1200 |
| commit | 0c9d8d34e1307433e27435c7d2f84557fd563752 (patch) | |
| tree | 70bc214fe520abc14e64d1a78cafffe178ae239c /Source/Core/Common/Src/FileUtil.cpp | |
| parent | 7784fa4c67cc8d2545f45694d83805e7e89cd583 (diff) | |
| parent | 3c87512180decf6b0aae9402a2179c73674ef5d8 (diff) | |
Merge branch 'master' into wii-network
Conflicts:
Source/Core/Core/CMakeLists.txt
Diffstat (limited to 'Source/Core/Common/Src/FileUtil.cpp')
| -rw-r--r-- | Source/Core/Common/Src/FileUtil.cpp | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/Source/Core/Common/Src/FileUtil.cpp b/Source/Core/Common/Src/FileUtil.cpp index bf7edb0844..af1329675d 100644 --- a/Source/Core/Common/Src/FileUtil.cpp +++ b/Source/Core/Common/Src/FileUtil.cpp @@ -124,7 +124,7 @@ bool Delete(const std::string &filename) // being there, not the actual delete. if (!Exists(filename)) { - WARN_LOG(COMMON, "Delete: %s does not exists", filename.c_str()); + WARN_LOG(COMMON, "Delete: %s does not exist", filename.c_str()); return true; } @@ -216,7 +216,7 @@ bool CreateFullPath(const std::string &fullPath) panicCounter--; if (panicCounter <= 0) { - ERROR_LOG(COMMON, "CreateFullPath: directory structure too deep"); + ERROR_LOG(COMMON, "CreateFullPath: directory structure is too deep"); return false; } position++; @@ -324,7 +324,7 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename) goto bail; } } - // close flushs + // close files fclose(input); fclose(output); return true; @@ -669,7 +669,7 @@ std::string GetSysDirectory() // Returns a string with a Dolphin data dir or file in the user's home // directory. To be used in "multi-user" mode (that is, installed). -std::string &GetUserPath(const unsigned int DirIDX, const std::string &newPath) +const std::string& GetUserPath(const unsigned int DirIDX, const std::string &newPath) { static std::string paths[NUM_PATH_INDICES]; @@ -724,11 +724,11 @@ std::string &GetUserPath(const unsigned int DirIDX, const std::string &newPath) if (!newPath.empty()) { if(DirIDX != D_WIIROOT_IDX) - PanicAlert("trying to change user path other than wii root"); + PanicAlert("Trying to change user path other than Wii root"); if (!File::IsDirectory(newPath)) { - WARN_LOG(COMMON, "Invalid path specified %s, wii user path will be set to default", newPath.c_str()); + WARN_LOG(COMMON, "Invalid path specified %s, Wii user path will be set to default", newPath.c_str()); paths[D_WIIROOT_IDX] = paths[D_USER_IDX] + WII_USER_DIR; } else @@ -744,6 +744,19 @@ std::string &GetUserPath(const unsigned int DirIDX, const std::string &newPath) return paths[DirIDX]; } +std::string GetThemeDir(const std::string& theme_name) +{ + std::string dir = File::GetUserPath(D_THEMES_IDX) + theme_name + "/"; + +#if !defined(_WIN32) + // If theme does not exist in user's dir load from shared directory + if (!File::Exists(dir)) + dir = SHARED_USER_DIR THEMES_DIR "/" + theme_name + "/"; +#endif + + return dir; +} + bool WriteStringToFile(bool text_file, const std::string &str, const char *filename) { return File::IOFile(filename, text_file ? "w" : "wb").WriteBytes(str.data(), str.size()); |
