diff --git a/v2rayN/v2rayN/Handler/CoreConfigHandler.cs b/v2rayN/v2rayN/Handler/CoreConfigHandler.cs index c0dc712e..95334ee9 100644 --- a/v2rayN/v2rayN/Handler/CoreConfigHandler.cs +++ b/v2rayN/v2rayN/Handler/CoreConfigHandler.cs @@ -80,6 +80,7 @@ namespace v2rayN.Handler if (File.Exists(fileName)) { + File.SetAttributes(fileName, FileAttributes.Normal); //If the file has a read-only attribute, direct deletion will fail File.Delete(fileName); } @@ -94,6 +95,7 @@ namespace v2rayN.Handler return -1; } File.Copy(addressFileName, fileName); + File.SetAttributes(fileName, FileAttributes.Normal); //Copy will keep the attributes of addressFileName, so we need to add write permissions to fileName just in case of addressFileName is a read-only file. //check again if (!File.Exists(fileName)) @@ -153,4 +155,4 @@ namespace v2rayN.Handler return coreConfigV2ray.GenerateClientSpeedtestConfigString(selecteds, out msg); } } -} \ No newline at end of file +}