mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 13:50:03 +00:00 
			
		
		
		
	Merge pull request #2185 from freiro/local_folder
Change "user" folder default location to AppData/Roaming/ on Windows systems
This commit is contained in:
		
						commit
						a0b30189e5
					
				
					 3 changed files with 18 additions and 1 deletions
				
			
		|  | @ -19,7 +19,7 @@ | ||||||
| #define EMU_DATA_DIR USER_DIR | #define EMU_DATA_DIR USER_DIR | ||||||
| #else | #else | ||||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||||
| #define EMU_DATA_DIR "Citra Emulator" | #define EMU_DATA_DIR "Citra" | ||||||
| #else | #else | ||||||
| #define EMU_DATA_DIR "citra-emu" | #define EMU_DATA_DIR "citra-emu" | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | @ -26,6 +26,9 @@ | ||||||
| #define stat _stat64 | #define stat _stat64 | ||||||
| #define fstat _fstat64 | #define fstat _fstat64 | ||||||
| #define fileno _fileno | #define fileno _fileno | ||||||
|  | // Windows version, at least Vista is required to obtain AppData Path
 | ||||||
|  | #define WINVER 0x0600 | ||||||
|  | #define _WIN32_WINNT 0x0600 | ||||||
| #else | #else | ||||||
| #ifdef __APPLE__ | #ifdef __APPLE__ | ||||||
| #include <sys/param.h> | #include <sys/param.h> | ||||||
|  | @ -594,6 +597,15 @@ std::string& GetExeDirectory() { | ||||||
|     } |     } | ||||||
|     return exe_path; |     return exe_path; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | std::string AppDataRoamingDirectory() { | ||||||
|  |     PWSTR pw_local_path = nullptr; | ||||||
|  |     // Only supported by Windows Vista or later
 | ||||||
|  |     SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, nullptr, &pw_local_path); | ||||||
|  |     std::string local_path = Common::UTF16ToUTF8(pw_local_path); | ||||||
|  |     CoTaskMemFree(pw_local_path); | ||||||
|  |     return local_path; | ||||||
|  | } | ||||||
| #else | #else | ||||||
| /**
 | /**
 | ||||||
|  * @return The user’s home directory on POSIX systems |  * @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 | ||||||
|     if (paths[D_USER_IDX].empty()) { |     if (paths[D_USER_IDX].empty()) { | ||||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||||
|         paths[D_USER_IDX] = GetExeDirectory() + DIR_SEP USERDATA_DIR DIR_SEP; |         paths[D_USER_IDX] = GetExeDirectory() + DIR_SEP USERDATA_DIR DIR_SEP; | ||||||
|  |         if (!FileUtil::IsDirectory(paths[D_USER_IDX])) { | ||||||
|  |             paths[D_USER_IDX] = AppDataRoamingDirectory() + DIR_SEP EMU_DATA_DIR DIR_SEP; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|         paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP; |         paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP; | ||||||
|         paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP; |         paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP; | ||||||
| #else | #else | ||||||
|  |  | ||||||
|  | @ -154,6 +154,7 @@ std::string GetBundleDirectory(); | ||||||
| 
 | 
 | ||||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||||
| std::string& GetExeDirectory(); | std::string& GetExeDirectory(); | ||||||
|  | std::string AppDataRoamingDirectory(); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| size_t WriteStringToFile(bool text_file, const std::string& str, const char* filename); | size_t WriteStringToFile(bool text_file, const std::string& str, const char* filename); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue