mirror of
				https://github.com/RetroDECK/Duckstation.git
				synced 2025-04-10 19:15:14 +00:00 
			
		
		
		
	Common/ByteStream: Use wide paths for committing updates
Fixes save states to UTF-8 paths.
This commit is contained in:
		
							parent
							
								
									e3721460a2
								
							
						
					
					
						commit
						a895c02789
					
				|  | @ -267,10 +267,12 @@ public: | ||||||
|     { |     { | ||||||
| #if WIN32 | #if WIN32 | ||||||
|       // delete the temporary file
 |       // delete the temporary file
 | ||||||
|       if (!DeleteFileA(m_temporaryFileName.c_str())) |       if (!DeleteFileW(StringUtil::UTF8StringToWideString(m_temporaryFileName).c_str())) | ||||||
|  |       { | ||||||
|         Log_WarningPrintf( |         Log_WarningPrintf( | ||||||
|           "AtomicUpdatedFileByteStream::~AtomicUpdatedFileByteStream(): Failed to delete temporary file '%s'", |           "AtomicUpdatedFileByteStream::~AtomicUpdatedFileByteStream(): Failed to delete temporary file '%s'", | ||||||
|           m_temporaryFileName.c_str()); |           m_temporaryFileName.c_str()); | ||||||
|  |       } | ||||||
| #else | #else | ||||||
|       // delete the temporary file
 |       // delete the temporary file
 | ||||||
|       if (remove(m_temporaryFileName.c_str()) < 0) |       if (remove(m_temporaryFileName.c_str()) < 0) | ||||||
|  | @ -308,7 +310,8 @@ public: | ||||||
| 
 | 
 | ||||||
| #ifdef WIN32 | #ifdef WIN32 | ||||||
|     // move the atomic file name to the original file name
 |     // move the atomic file name to the original file name
 | ||||||
|     if (!MoveFileExA(m_temporaryFileName.c_str(), m_originalFileName.c_str(), MOVEFILE_REPLACE_EXISTING)) |     if (!MoveFileExW(StringUtil::UTF8StringToWideString(m_temporaryFileName).c_str(), | ||||||
|  |                      StringUtil::UTF8StringToWideString(m_originalFileName).c_str(), MOVEFILE_REPLACE_EXISTING)) | ||||||
|     { |     { | ||||||
|       Log_WarningPrintf("AtomicUpdatedFileByteStream::Commit(): Failed to rename temporary file '%s' to '%s'", |       Log_WarningPrintf("AtomicUpdatedFileByteStream::Commit(): Failed to rename temporary file '%s' to '%s'", | ||||||
|                         m_temporaryFileName.c_str(), m_originalFileName.c_str()); |                         m_temporaryFileName.c_str(), m_originalFileName.c_str()); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Connor McLaughlin
						Connor McLaughlin