[blam/blam-1.8.10] ChannelCollection: reliably save the state



commit 97459c77dbe869742b954dece19341e929c7f26a
Author: Carlos MartÃn Nieto <carlos cmartin tk>
Date:   Sat May 12 20:14:43 2012 +0200

    ChannelCollection: reliably save the state
    
    Use File.Copy() + File.Delete() to replace the collection savefile,
    telling it to overwrite an existing file if it exists.

 src/ChannelCollection.cs |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/ChannelCollection.cs b/src/ChannelCollection.cs
index f5ff5c5..8cf71b5 100644
--- a/src/ChannelCollection.cs
+++ b/src/ChannelCollection.cs
@@ -153,7 +153,8 @@ namespace Imendio.Blam {
 
 		// Move the file to the real one
 		try {
-		    File.Replace (tmpFile, this.FileName, this.FileName + ".bk");
+			File.Copy(tmpFile, this.FileName, true);
+			File.Delete(tmpFile);
 		} catch (Exception e) {
 		    Console.Error.WriteLine ("File replace error: " + e.Message);
 		    return;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]