mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 05:40:04 +00:00 
			
		
		
		
	Return by value and other fixes
This commit is contained in:
		
							parent
							
								
									29bb82cb8e
								
							
						
					
					
						commit
						3d75e3cd07
					
				
					 2 changed files with 8 additions and 14 deletions
				
			
		|  | @ -598,18 +598,12 @@ std::string& GetExeDirectory() { | ||||||
|     return exe_path; |     return exe_path; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| std::string& AppDataLocalDirectory() { | std::string AppDataLocalDirectory() { | ||||||
|     // Windows Vista or later only
 |     PWSTR pw_local_path = nullptr; | ||||||
|     static std::string local_path; |     // Only supported by Windows Vista or later
 | ||||||
|     if (local_path.empty()) { |     SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, nullptr, &pw_local_path); | ||||||
|         PWSTR pw_local_path = 0; |     std::string local_path = Common::UTF16ToUTF8(pw_local_path); | ||||||
|         wchar_t* wchar_local_path; |     CoTaskMemFree(pw_local_path); | ||||||
|         SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, NULL, &pw_local_path); |  | ||||||
|         wchar_local_path = pw_local_path; |  | ||||||
|         local_path = Common::UTF16ToUTF8(wchar_local_path); |  | ||||||
|         // Freeing memory
 |  | ||||||
|         CoTaskMemFree(static_cast<void*>(pw_local_path)); |  | ||||||
|     } |  | ||||||
|     return local_path; |     return local_path; | ||||||
| } | } | ||||||
| #else | #else | ||||||
|  | @ -691,7 +685,7 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string& new | ||||||
|         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])) { |         if (!FileUtil::IsDirectory(paths[D_USER_IDX])) { | ||||||
|             paths[D_USER_IDX] = |             paths[D_USER_IDX] = | ||||||
|                 AppDataLocalDirectory() + DIR_SEP + EMU_DATA_DIR DIR_SEP USERDATA_DIR DIR_SEP; |                 AppDataLocalDirectory() + DIR_SEP EMU_DATA_DIR DIR_SEP USERDATA_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; | ||||||
|  |  | ||||||
|  | @ -154,7 +154,7 @@ std::string GetBundleDirectory(); | ||||||
| 
 | 
 | ||||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||||
| std::string& GetExeDirectory(); | std::string& GetExeDirectory(); | ||||||
| std::string& AppDataLocalDirectory(); | std::string AppDataLocalDirectory(); | ||||||
| #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