Browse Source

Give core execute permission at runtime

pull/5940/head
2dust 4 weeks ago
parent
commit
0efb0b5e3e
  1. 23
      v2rayN/ServiceLib/Handler/CoreHandler.cs
  2. 2
      v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs

23
v2rayN/ServiceLib/Handler/CoreHandler.cs

@ -15,13 +15,34 @@ namespace ServiceLib.Handler
private Process? _processPre;
private Action<bool, string>? _updateFunc;
public void Init(Config config, Action<bool, string> updateFunc)
public async Task Init(Config config, Action<bool, string> updateFunc)
{
_config = config;
_updateFunc = updateFunc;
Environment.SetEnvironmentVariable("V2RAY_LOCATION_ASSET", Utils.GetBinPath(""), EnvironmentVariableTarget.Process);
Environment.SetEnvironmentVariable("XRAY_LOCATION_ASSET", Utils.GetBinPath(""), EnvironmentVariableTarget.Process);
if (Utils.IsLinux())
{
var coreInfo = CoreInfoHandler.Instance.GetCoreInfo();
foreach (var it in coreInfo)
{
if (it.CoreType == ECoreType.v2rayN)
{
continue;
}
foreach (var vName in it.CoreExes)
{
var exe = Utils.GetExeName(Utils.GetBinPath(vName, it.CoreType.ToString()));
if (File.Exists(exe))
{
await Utils.SetLinuxChmod(exe);
}
}
}
}
}
public async Task LoadCore(ProfileItem? node)

2
v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs

@ -208,7 +208,7 @@ namespace ServiceLib.ViewModels
await ConfigHandler.InitBuiltinRouting(_config);
await ConfigHandler.InitBuiltinDNS(_config);
CoreHandler.Instance.Init(_config, UpdateHandler);
await CoreHandler.Instance.Init(_config, UpdateHandler);
TaskHandler.Instance.RegUpdateTask(_config, UpdateTaskHandler);
if (_config.GuiItem.EnableStatistics)

Loading…
Cancel
Save