From 2df412476a6ad67e2e4c443d578c6127df25c6c2 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Sun, 9 Mar 2025 19:04:49 +0800 Subject: [PATCH] If it is a Windows WinGet installation, the configuration file is stored in the user directory https://github.com/2dust/v2rayN/issues/6803 --- v2rayN/ServiceLib/Common/Utils.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/v2rayN/ServiceLib/Common/Utils.cs b/v2rayN/ServiceLib/Common/Utils.cs index 5883d3db..dcfc04e4 100644 --- a/v2rayN/ServiceLib/Common/Utils.cs +++ b/v2rayN/ServiceLib/Common/Utils.cs @@ -564,13 +564,20 @@ namespace ServiceLib.Common { try { + var basePath = GetBaseDirectory(); //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; } - 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)) { Directory.CreateDirectory(tempPath);