Fix risk of having only WTelegram.session.tmp if killing the program in the middle of Delete/Move

(that's what File.Replace was trying to avoid!!)
This commit is contained in:
Wizou 2021-12-30 23:43:00 +01:00
parent a7fcbf60fa
commit 4739c9f539
2 changed files with 9 additions and 12 deletions

View file

@ -91,8 +91,8 @@ namespace WTelegram
lock (this)
{
File.WriteAllBytes(tempPathname, output);
File.Delete(_pathname);
File.Move(tempPathname, _pathname);
File.Copy(tempPathname, _pathname, true);
File.Delete(tempPathname);
}
}
}