diff options
| author | Ryan Houdek <Sonicadvance1@gmail.com> | 2013-04-13 00:58:37 -0500 |
|---|---|---|
| committer | Ryan Houdek <Sonicadvance1@gmail.com> | 2013-04-13 00:58:37 -0500 |
| commit | 605bbf5ca833399c1a6aad2a3b0e21cb4c910d11 (patch) | |
| tree | 53acc60e471e39f234af37ac56c4ce39029eb60b /Source/Core/Common/Src/FileUtil.cpp | |
| parent | 2444fdbbdd4310f0e012b661d258b20a4eaf4800 (diff) | |
| parent | 48927c17d252223ffdaa5cfb34aa850eb6ee6ee1 (diff) | |
Merge remote-tracking branch 'origin/master' into Android-trash
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 e8a7540c0a..ab58cb3f98 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]; @@ -723,11 +723,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 @@ -742,6 +742,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()); |
