mirror of
https://github.com/2dust/v2rayN.git
synced 2025-10-27 10:40:08 +00:00
Compare commits
1 commit
d53039e541
...
790025718d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
790025718d |
2 changed files with 22 additions and 51 deletions
|
|
@ -857,55 +857,6 @@ public class Utils
|
|||
return false;
|
||||
}
|
||||
|
||||
public static bool IsPackagedInstall()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (IsWindows() || IsOSX())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("APPIMAGE")))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
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 (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;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static async Task<string?> GetLinuxUserId()
|
||||
{
|
||||
var arg = new List<string>() { "-c", "id -u" };
|
||||
|
|
|
|||
|
|
@ -61,9 +61,29 @@ public class CheckUpdateViewModel : MyReactiveObject
|
|||
CheckUpdateModels.Add(GetCheckUpdateModel(_geo));
|
||||
}
|
||||
|
||||
private static bool IsPackagedInstall()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Utils.IsWindows())
|
||||
return false;
|
||||
if (!string.IsNullOrEmpty(System.Environment.GetEnvironmentVariable("APPIMAGE")))
|
||||
return true;
|
||||
var sp = Utils.StartupPath()?.Replace('\\', '/');
|
||||
if (!string.IsNullOrEmpty(sp) && sp.StartsWith("/opt/v2rayN", StringComparison.Ordinal))
|
||||
return true;
|
||||
var procPath = System.Environment.ProcessPath;
|
||||
var procDir = string.IsNullOrEmpty(procPath) ? "" : System.IO.Path.GetDirectoryName(procPath)?.Replace('\\', '/');
|
||||
if (!string.IsNullOrEmpty(procDir) && procDir.StartsWith("/opt/v2rayN", StringComparison.Ordinal))
|
||||
return true;
|
||||
}
|
||||
catch { }
|
||||
return false;
|
||||
}
|
||||
|
||||
private CheckUpdateModel GetCheckUpdateModel(string coreType)
|
||||
{
|
||||
if (coreType == _v2rayN && Utils.IsPackagedInstall())
|
||||
if (coreType == _v2rayN && IsPackagedInstall())
|
||||
{
|
||||
return new()
|
||||
{
|
||||
|
|
@ -114,7 +134,7 @@ public class CheckUpdateViewModel : MyReactiveObject
|
|||
}
|
||||
else if (item.CoreType == _v2rayN)
|
||||
{
|
||||
if (Utils.IsPackagedInstall())
|
||||
if (IsPackagedInstall())
|
||||
{
|
||||
await UpdateView(_v2rayN, "Not Support");
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Reference in a new issue