Closes SpartanJ/ecode#31.
Closes SpartanJ/ecode#32.
Also fixes some other error with wrong encodings on Windows.
This commit is contained in:
Martín Lucas Golini
2023-02-07 00:08:12 -03:00
parent 33f69b8423
commit 9bdadb1f22
5 changed files with 27 additions and 10 deletions
+9 -1
View File
@@ -1946,6 +1946,14 @@ UIMessageBox* App::newInputMsgBox( const String& title, const String& msg ) {
return msgBox;
}
static void fsRenameFile( const std::string& fpath, const std::string& newFilePath ) {
#if EE_PLATFORM == EE_PLATFORM_WIN
fs::rename( String( fpath ).toWideString(), String(newFilePath).toWideString() );
#else
fs::rename( fpath, newFilePath );
#endif
}
void App::renameFile( const FileInfo& file ) {
if ( !file.exists() )
return;
@@ -1960,7 +1968,7 @@ void App::renameFile( const FileInfo& file ) {
std::string fpath( file.getFilepath() );
if ( file.isDirectory() )
FileSystem::dirRemoveSlashAtEnd( fpath );
fs::rename( fpath, newFilePath );
fsRenameFile( fpath, newFilePath );
} catch ( const fs::filesystem_error& err ) {
errorMsgBox( i18n( "error_renaming_file", "Error renaming file." ) );
}