Replace GetOptCore with GetOptBinPath for getting /opt/v2rayN/bin/ paths

This commit is contained in:
Valeriy Manzhos 2026-04-07 13:37:25 +03:00
parent 33b9f15415
commit f72f9df967
No known key found for this signature in database
GPG key ID: 6547CFC8E2EC3D90
2 changed files with 12 additions and 3 deletions

View file

@ -1093,14 +1093,23 @@ public class Utils
} }
} }
public static string GetOptCorePath(string filename = "") public static string GetOptBinPath(string filename, string? coreType = null)
{ {
var tempPath = Path.Combine("/opt/v2rayn-core"); var tempPath = Path.Combine("/opt/v2rayN/","bin");
if (!Directory.Exists(tempPath)) if (!Directory.Exists(tempPath))
{ {
Directory.CreateDirectory(tempPath); Directory.CreateDirectory(tempPath);
} }
if (coreType != null)
{
tempPath = Path.Combine(tempPath, coreType.ToLower().ToString());
if (!Directory.Exists(tempPath))
{
Directory.CreateDirectory(tempPath);
}
}
if (filename.IsNullOrEmpty()) if (filename.IsNullOrEmpty())
{ {
return tempPath; return tempPath;

View file

@ -35,7 +35,7 @@ public sealed class CoreInfoManager
msg = string.Empty; msg = string.Empty;
foreach (var name in coreInfo?.CoreExes) foreach (var name in coreInfo?.CoreExes)
{ {
var vName = Utils.GetBinPath(Utils.GetExeName(name), coreInfo.CoreType.ToString()); var vName = Utils.GetOptBinPath(Utils.GetExeName(name), coreInfo.CoreType.ToString());
if (File.Exists(vName)) if (File.Exists(vName))
{ {
fileName = vName; fileName = vName;