Do not move symlinks when saving a map, overwrite target instead
If the user is editing a symlink to a target instead of a real file, chances are high they want the symlink to stay in place. Precondition: some.map -> /path/to/elsewhere.map After save (before): some.bak -> /path/to/elsewhere.map some.map (real file) After save (after): some.map -> /path/to/elsewhere.map Closes #107.
This commit is contained in:
@@ -175,13 +175,10 @@ bool Preferences_Save( PreferenceDictionary& preferences, const char* filename )
|
||||
|
||||
bool Preferences_Save_Safe( PreferenceDictionary& preferences, const char* filename ){
|
||||
const auto tmpName = StringOutputStream()( filename, "TMP" );
|
||||
return Preferences_Save( preferences, tmpName )
|
||||
&& ( !file_exists( filename ) || file_remove( filename ) )
|
||||
&& file_move( tmpName, filename );
|
||||
return Preferences_Save( preferences, tmpName ) && file_move( tmpName, filename );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void LogConsole_importString( const char* string ){
|
||||
g_Console_enableLogging = string_equal( string, "true" );
|
||||
Sys_LogFile( g_Console_enableLogging );
|
||||
|
||||
Reference in New Issue
Block a user