From fffdbd4dd1749fa08ecaaaf57e25cb62d90df9d0 Mon Sep 17 00:00:00 2001 From: JieXu Date: Fri, 12 Sep 2025 12:27:31 +0800 Subject: [PATCH] Update Utils.cs --- v2rayN/ServiceLib/Common/Utils.cs | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/v2rayN/ServiceLib/Common/Utils.cs b/v2rayN/ServiceLib/Common/Utils.cs index 49a359c0..297ef2de 100644 --- a/v2rayN/ServiceLib/Common/Utils.cs +++ b/v2rayN/ServiceLib/Common/Utils.cs @@ -857,6 +857,37 @@ public class Utils return false; } + public static bool IsPackagedInstall() + { + try + { + if (IsWindows() || IsOSX()) + { + return false; + } + + if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("APPIMAGE"))) + { + return true; + } + + var sp = StartupPath()?.Replace('\\', '/'); + if (!string.IsNullOrEmpty(sp) && sp.StartsWith("/opt/v2rayN", StringComparison.OrdinalIgnoreCase)) + { + return true; + } + + if (Directory.Exists("/opt/v2rayN")) + { + return true; + } + } + catch + { + } + return false; + } + private static async Task GetLinuxUserId() { var arg = new List() { "-c", "id -u" };