Add IsNonWindows instead of IsLinux or IsOSX
This commit is contained in:
@@ -710,7 +710,7 @@ namespace ServiceLib.Common
|
||||
|
||||
public static string StartupPath()
|
||||
{
|
||||
if (Utils.IsLinux() && Environment.GetEnvironmentVariable("V2RAYN_LOCAL_APPLICATION_DATA") == "1")
|
||||
if (Utils.IsNonWindows() && Environment.GetEnvironmentVariable("V2RAYN_LOCAL_APPLICATION_DATA") == "1")
|
||||
{
|
||||
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "v2rayN");
|
||||
}
|
||||
@@ -838,6 +838,8 @@ namespace ServiceLib.Common
|
||||
|
||||
public static bool IsOSX() => RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
|
||||
|
||||
public static bool IsNonWindows() => !RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
|
||||
|
||||
public static string GetExeName(string name)
|
||||
{
|
||||
return IsWindows() ? $"{name}.exe" : name;
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
public bool InitApp()
|
||||
{
|
||||
if (Utils.IsLinux() && Utils.HasWritePermission() == false)
|
||||
if (Utils.IsNonWindows() && Utils.HasWritePermission() == false)
|
||||
{
|
||||
Environment.SetEnvironmentVariable("V2RAYN_LOCAL_APPLICATION_DATA", "1", EnvironmentVariableTarget.Process);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace ServiceLib.Handler
|
||||
Environment.SetEnvironmentVariable("V2RAY_LOCATION_ASSET", Utils.GetBinPath(""), EnvironmentVariableTarget.Process);
|
||||
Environment.SetEnvironmentVariable("XRAY_LOCATION_ASSET", Utils.GetBinPath(""), EnvironmentVariableTarget.Process);
|
||||
|
||||
if (Utils.IsLinux() || Utils.IsOSX())
|
||||
if (Utils.IsNonWindows())
|
||||
{
|
||||
var coreInfo = CoreInfoHandler.Instance.GetCoreInfo();
|
||||
foreach (var it in coreInfo)
|
||||
@@ -221,7 +221,7 @@ namespace ServiceLib.Handler
|
||||
{
|
||||
return _config.TunModeItem.EnableTun
|
||||
&& eCoreType == ECoreType.sing_box
|
||||
&& (Utils.IsLinux() || Utils.IsOSX())
|
||||
&& (Utils.IsNonWindows())
|
||||
//&& _config.TunModeItem.LinuxSudoPwd.IsNotEmpty()
|
||||
;
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ namespace ServiceLib.ViewModels
|
||||
FileManager.ZipExtractToFile(fileName, toPath, _config.GuiItem.IgnoreGeoUpdateCore ? "geo" : "");
|
||||
}
|
||||
|
||||
if (Utils.IsLinux() || Utils.IsOSX())
|
||||
if (Utils.IsNonWindows())
|
||||
{
|
||||
var filesList = (new DirectoryInfo(toPath)).GetFiles().Select(u => u.FullName).ToList();
|
||||
foreach (var file in filesList)
|
||||
|
||||
@@ -215,7 +215,7 @@ namespace v2rayN.Desktop.Views
|
||||
{
|
||||
return lstFonts;
|
||||
}
|
||||
else if (Utils.IsLinux() || Utils.IsOSX())
|
||||
else if (Utils.IsNonWindows())
|
||||
{
|
||||
var result = await Utils.GetLinuxFontFamily("zh");
|
||||
if (result.IsNullOrEmpty())
|
||||
|
||||
Reference in New Issue
Block a user