Update Utils.cs

This commit is contained in:
JieXu 2025-09-12 12:52:46 +08:00 committed by GitHub
parent 8eeedbdb23
commit 2236b1b688
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -871,13 +871,31 @@ public class Utils
return true;
}
var sp = StartupPath()?.Replace('\\', '/');
if (!string.IsNullOrEmpty(sp) && sp.StartsWith("/opt/v2rayN", StringComparison.OrdinalIgnoreCase))
var exePath = GetExePath();
var baseDir = string.IsNullOrEmpty(exePath) ? StartupPath() : Path.GetDirectoryName(exePath) ?? "";
var p = baseDir.Replace('\\', '/');
if (string.IsNullOrEmpty(p))
{
return false;
}
if (p.Contains("/.mount_", StringComparison.Ordinal))
{
return true;
}
if (Directory.Exists("/opt/v2rayN"))
if (p.StartsWith("/opt/v2rayN", StringComparison.OrdinalIgnoreCase))
{
return true;
}
if (p.StartsWith("/usr/lib/v2rayN", StringComparison.OrdinalIgnoreCase))
{
return true;
}
if (p.StartsWith("/usr/share/v2rayN", StringComparison.OrdinalIgnoreCase))
{
return true;
}