diff --git a/v2rayN/ServiceLib/Handler/CoreHandler.cs b/v2rayN/ServiceLib/Handler/CoreHandler.cs index 001170cc..33d78f74 100644 --- a/v2rayN/ServiceLib/Handler/CoreHandler.cs +++ b/v2rayN/ServiceLib/Handler/CoreHandler.cs @@ -15,13 +15,34 @@ namespace ServiceLib.Handler private Process? _processPre; private Action? _updateFunc; - public void Init(Config config, Action updateFunc) + public async Task Init(Config config, Action 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) diff --git a/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs b/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs index efedf556..e1961b2a 100644 --- a/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs +++ b/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)