mirror of https://github.com/2dust/v2rayN
Fixed the issue of readonly custom config
Fixed the issue where importing read-only custom files would cause the service to fail to startpull/4409/head
parent
f3f3dc1951
commit
6b62623615
|
@ -80,6 +80,7 @@ namespace v2rayN.Handler
|
||||||
|
|
||||||
if (File.Exists(fileName))
|
if (File.Exists(fileName))
|
||||||
{
|
{
|
||||||
|
File.SetAttributes(fileName, FileAttributes.Normal); //If the file has a read-only attribute, direct deletion will fail
|
||||||
File.Delete(fileName);
|
File.Delete(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,6 +95,7 @@ namespace v2rayN.Handler
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
File.Copy(addressFileName, fileName);
|
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
|
//check again
|
||||||
if (!File.Exists(fileName))
|
if (!File.Exists(fileName))
|
||||||
|
@ -153,4 +155,4 @@ namespace v2rayN.Handler
|
||||||
return coreConfigV2ray.GenerateClientSpeedtestConfigString(selecteds, out msg);
|
return coreConfigV2ray.GenerateClientSpeedtestConfigString(selecteds, out msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue