Better handle .miCASA persistent file

This commit is contained in:
Jim Norman 2005-10-27 20:33:35 +00:00
parent 51ed454f9c
commit 92075e8aff

View File

@ -103,8 +103,18 @@ namespace sscs.lss
try try
{ {
string fileName = userStore.GetPersistenceFilePath(); string fileName = userStore.GetPersistenceFilePath();
if(!File.Exists(fileName)) if(!File.Exists(fileName))
return null; {
// check for tmp file
if (File.Exists(fileName+".tmp"))
File.Move(fileName+".tmp", fileName);
else
return null;
}
// delete tmp file if there
if (File.Exists(fileName+".tmp"))
File.Delete(fileName+".tmp");
byte[] baPasscode = CASACrypto.GetMasterPasscode(userStore.GetDesktopPasswd(),userStore.GetPasscodeByDesktopFilePath()); byte[] baPasscode = CASACrypto.GetMasterPasscode(userStore.GetDesktopPasswd(),userStore.GetPasscodeByDesktopFilePath());
if( null == baPasscode ) if( null == baPasscode )
@ -398,6 +408,9 @@ namespace sscs.lss
// rename existing file // rename existing file
if(File.Exists(fileName)) if(File.Exists(fileName))
{ {
if (File.Exists(fileName+".tmp"))
File.Delete(fileName+".tmp");
File.Move(fileName, fileName+".tmp"); File.Move(fileName, fileName+".tmp");
} }