Fix issue when saving gui config

This commit is contained in:
2dust 2022-04-30 08:32:42 +08:00
parent bcda8bd602
commit 52b8f480f6

View file

@ -210,8 +210,7 @@ namespace v2rayN.Handler
{ {
try try
{ {
Task.Run(() =>
{
//save temp file //save temp file
var temp = $"{configRes}_temp"; var temp = $"{configRes}_temp";
if (Utils.ToJsonFile(config, Utils.GetPath(temp)) != 0) if (Utils.ToJsonFile(config, Utils.GetPath(temp)) != 0)
@ -219,9 +218,12 @@ namespace v2rayN.Handler
return; return;
} }
if (File.Exists(configRes))
{
File.Delete(configRes);
}
//rename //rename
File.Move(temp, configRes); File.Move(temp, configRes);
});
} }
catch (Exception ex) catch (Exception ex)
{ {