Skip to content

Commit 2df4124

Browse files
committed
If it is a Windows WinGet installation, the configuration file is stored in the user directory
#6803
1 parent e6011cf commit 2df4124

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

v2rayN/ServiceLib/Common/Utils.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -564,13 +564,20 @@ public static bool HasWritePermission()
564564
{
565565
try
566566
{
567+
var basePath = GetBaseDirectory();
567568
//When this file exists, it is equivalent to having no permission to read and write
568-
if (File.Exists(Path.Combine(GetBaseDirectory(), "NotStoreConfigHere.txt")))
569+
if (File.Exists(Path.Combine(basePath, "NotStoreConfigHere.txt")))
569570
{
570571
return false;
571572
}
572573

573-
var tempPath = Path.Combine(GetBaseDirectory(), "guiTemps");
574+
//Check if it is installed by Windows WinGet
575+
if (IsWindows() && basePath.Contains("Users") && basePath.Contains("WinGet"))
576+
{
577+
return false;
578+
}
579+
580+
var tempPath = Path.Combine(basePath, "guiTemps");
574581
if (!Directory.Exists(tempPath))
575582
{
576583
Directory.CreateDirectory(tempPath);

0 commit comments

Comments
 (0)