If it is a Windows WinGet installation, the configuration file is stored in the user directory
Some checks failed
release Linux / build (Release) (push) Has been cancelled
release macOS / build (Release) (push) Has been cancelled
release Windows desktop (Avalonia UI) / build (Release) (push) Has been cancelled
release Windows / build (Release) (push) Has been cancelled

https://github.com/2dust/v2rayN/issues/6803
This commit is contained in:
2dust 2025-03-09 19:04:49 +08:00
parent e6011cfede
commit 2df412476a

View file

@ -564,13 +564,20 @@ namespace ServiceLib.Common
{ {
try try
{ {
var basePath = GetBaseDirectory();
//When this file exists, it is equivalent to having no permission to read and write //When this file exists, it is equivalent to having no permission to read and write
if (File.Exists(Path.Combine(GetBaseDirectory(), "NotStoreConfigHere.txt"))) if (File.Exists(Path.Combine(basePath, "NotStoreConfigHere.txt")))
{ {
return false; return false;
} }
var tempPath = Path.Combine(GetBaseDirectory(), "guiTemps"); //Check if it is installed by Windows WinGet
if (IsWindows() && basePath.Contains("Users") && basePath.Contains("WinGet"))
{
return false;
}
var tempPath = Path.Combine(basePath, "guiTemps");
if (!Directory.Exists(tempPath)) if (!Directory.Exists(tempPath))
{ {
Directory.CreateDirectory(tempPath); Directory.CreateDirectory(tempPath);