mirror of
https://github.com/wiz0u/WTelegramClient.git
synced 2026-01-02 06:39:55 +01:00
Fix System.IO.IOException: 'Unable to remove the file to be replaced. ' #10
Based on: 00416bc92f
This commit is contained in:
parent
15c3fda05d
commit
62dad83370
2
.github/dev.yml
vendored
2
.github/dev.yml
vendored
|
|
@ -2,7 +2,7 @@ pr: none
|
|||
trigger:
|
||||
- master
|
||||
|
||||
name: 1.7.6-dev.$(Rev:r)
|
||||
name: 1.7.7-dev.$(Rev:r)
|
||||
|
||||
pool:
|
||||
vmImage: ubuntu-latest
|
||||
|
|
|
|||
|
|
@ -87,14 +87,13 @@ namespace WTelegram
|
|||
encryptor.TransformBlock(utf8Json, 0, utf8Json.Length & ~15, output, 48);
|
||||
utf8Json.AsSpan(utf8Json.Length & ~15).CopyTo(finalBlock);
|
||||
encryptor.TransformFinalBlock(finalBlock, 0, utf8Json.Length & 15).CopyTo(output.AsMemory(48 + utf8Json.Length & ~15));
|
||||
if (!File.Exists(_pathname))
|
||||
File.WriteAllBytes(_pathname, output);
|
||||
else lock (this)
|
||||
{
|
||||
string tempPathname = _pathname + ".tmp";
|
||||
File.WriteAllBytes(tempPathname, output);
|
||||
File.Replace(tempPathname, _pathname, null);
|
||||
}
|
||||
string tempPathname = _pathname + ".tmp";
|
||||
lock (this)
|
||||
{
|
||||
File.WriteAllBytes(tempPathname, output);
|
||||
File.Delete(_pathname);
|
||||
File.Move(tempPathname, _pathname);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue