File tree 1 file changed +8
-1
lines changed
source/VersionHandlerImpl/src
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -818,8 +818,9 @@ private static void Save() {
818
818
return ;
819
819
}
820
820
try {
821
+ string tmpFile = Path . GetTempFileName ( ) ;
821
822
using ( var writer =
822
- XmlWriter . Create ( PROJECT_SETTINGS_FILE ,
823
+ XmlWriter . Create ( tmpFile ,
823
824
new XmlWriterSettings {
824
825
Encoding = new UTF8Encoding ( false ) ,
825
826
Indent = true ,
@@ -839,6 +840,8 @@ private static void Save() {
839
840
}
840
841
writer . WriteEndElement ( ) ;
841
842
}
843
+
844
+ File . Copy ( tmpFile , PROJECT_SETTINGS_FILE , true ) ;
842
845
} catch ( Exception exception ) {
843
846
if ( exception is IOException || exception is UnauthorizedAccessException ) {
844
847
logger . Log ( String . Format ( "Unable to write to '{0}' ({1}, " +
@@ -848,6 +851,10 @@ private static void Save() {
848
851
}
849
852
throw exception ;
850
853
}
854
+ finally
855
+ {
856
+ File . Delete ( tmpFile ) ;
857
+ }
851
858
}
852
859
}
853
860
}
You can’t perform that action at this time.
0 commit comments