summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner2016-11-26 14:07:43 -0800
committerGravatar GitHub2016-11-26 14:07:43 -0800
commita0b30189e5749d0bde91b09a3b64a716a2823e98 (patch)
treeda987dac8a7775d7f623194aa50e73dfbf2903e6
parentMerge pull request #2215 from MerryMage/ticks_executed (diff)
parentMove to AppData/Roaming/Citra/ (diff)
downloadyuzu-a0b30189e5749d0bde91b09a3b64a716a2823e98.tar.gz
yuzu-a0b30189e5749d0bde91b09a3b64a716a2823e98.tar.xz
yuzu-a0b30189e5749d0bde91b09a3b64a716a2823e98.zip
Merge pull request #2185 from freiro/local_folder
Change "user" folder default location to AppData/Roaming/ on Windows systems
Diffstat (limited to '')
-rw-r--r--src/common/common_paths.h2
-rw-r--r--src/common/file_util.cpp16
-rw-r--r--src/common/file_util.h1
3 files changed, 18 insertions, 1 deletions
diff --git a/src/common/common_paths.h b/src/common/common_paths.h
index a5342a610..37304d236 100644
--- a/src/common/common_paths.h
+++ b/src/common/common_paths.h
@@ -19,7 +19,7 @@
19#define EMU_DATA_DIR USER_DIR 19#define EMU_DATA_DIR USER_DIR
20#else 20#else
21#ifdef _WIN32 21#ifdef _WIN32
22#define EMU_DATA_DIR "Citra Emulator" 22#define EMU_DATA_DIR "Citra"
23#else 23#else
24#define EMU_DATA_DIR "citra-emu" 24#define EMU_DATA_DIR "citra-emu"
25#endif 25#endif
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp
index 407ed047a..413a8e7e5 100644
--- a/src/common/file_util.cpp
+++ b/src/common/file_util.cpp
@@ -26,6 +26,9 @@
26#define stat _stat64 26#define stat _stat64
27#define fstat _fstat64 27#define fstat _fstat64
28#define fileno _fileno 28#define fileno _fileno
29// Windows version, at least Vista is required to obtain AppData Path
30#define WINVER 0x0600
31#define _WIN32_WINNT 0x0600
29#else 32#else
30#ifdef __APPLE__ 33#ifdef __APPLE__
31#include <sys/param.h> 34#include <sys/param.h>
@@ -594,6 +597,15 @@ std::string& GetExeDirectory() {
594 } 597 }
595 return exe_path; 598 return exe_path;
596} 599}
600
601std::string AppDataRoamingDirectory() {
602 PWSTR pw_local_path = nullptr;
603 // Only supported by Windows Vista or later
604 SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, nullptr, &pw_local_path);
605 std::string local_path = Common::UTF16ToUTF8(pw_local_path);
606 CoTaskMemFree(pw_local_path);
607 return local_path;
608}
597#else 609#else
598/** 610/**
599 * @return The user’s home directory on POSIX systems 611 * @return The user’s home directory on POSIX systems
@@ -671,6 +683,10 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string& new
671 if (paths[D_USER_IDX].empty()) { 683 if (paths[D_USER_IDX].empty()) {
672#ifdef _WIN32 684#ifdef _WIN32
673 paths[D_USER_IDX] = GetExeDirectory() + DIR_SEP USERDATA_DIR DIR_SEP; 685 paths[D_USER_IDX] = GetExeDirectory() + DIR_SEP USERDATA_DIR DIR_SEP;
686 if (!FileUtil::IsDirectory(paths[D_USER_IDX])) {
687 paths[D_USER_IDX] = AppDataRoamingDirectory() + DIR_SEP EMU_DATA_DIR DIR_SEP;
688 }
689
674 paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP; 690 paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP;
675 paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP; 691 paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP;
676#else 692#else
diff --git a/src/common/file_util.h b/src/common/file_util.h
index 204b06f14..ac58607c5 100644
--- a/src/common/file_util.h
+++ b/src/common/file_util.h
@@ -154,6 +154,7 @@ std::string GetBundleDirectory();
154 154
155#ifdef _WIN32 155#ifdef _WIN32
156std::string& GetExeDirectory(); 156std::string& GetExeDirectory();
157std::string AppDataRoamingDirectory();
157#endif 158#endif
158 159
159size_t WriteStringToFile(bool text_file, const std::string& str, const char* filename); 160size_t WriteStringToFile(bool text_file, const std::string& str, const char* filename);