Add environment variables to geo files

This commit is contained in:
2dust 2023-02-10 11:22:03 +08:00
parent dec722e693
commit 9b05736746
4 changed files with 19 additions and 10 deletions

View file

@ -20,6 +20,9 @@ namespace v2rayN.Handler
public CoreHandler(Action<bool, string> update) public CoreHandler(Action<bool, string> update)
{ {
_updateFunc = update; _updateFunc = update;
Environment.SetEnvironmentVariable("v2ray.location.asset", Utils.GetBinPath(""), EnvironmentVariableTarget.Process);
Environment.SetEnvironmentVariable("xray.location.asset", Utils.GetBinPath(""), EnvironmentVariableTarget.Process);
} }
public void LoadCore(Config config) public void LoadCore(Config config)

View file

@ -278,11 +278,13 @@ namespace v2rayN.Handler
string fileName = Utils.GetTempPath(Utils.GetDownloadFileName(url)); string fileName = Utils.GetTempPath(Utils.GetDownloadFileName(url));
if (File.Exists(fileName)) if (File.Exists(fileName))
{ {
Global.coreTypes.ForEach(it => //Global.coreTypes.ForEach(it =>
{ //{
string targetPath = Utils.GetBinPath($"{geoName}.dat", (ECoreType)Enum.Parse(typeof(ECoreType), it)); // string targetPath = Utils.GetBinPath($"{geoName}.dat", (ECoreType)Enum.Parse(typeof(ECoreType), it));
File.Copy(fileName, targetPath, true); // File.Copy(fileName, targetPath, true);
}); //});
string targetPath = Utils.GetBinPath($"{geoName}.dat");
File.Copy(fileName, targetPath, true);
File.Delete(fileName); File.Delete(fileName);
//_updateFunc(true, ""); //_updateFunc(true, "");

View file

@ -116,10 +116,7 @@
get; set; get; set;
} }
public bool ignoreGeoUpdateCore public bool ignoreGeoUpdateCore { get; set; } = true;
{
get; set;
}
/// <summary> /// <summary>
/// systemProxyExceptions /// systemProxyExceptions

View file

@ -1117,7 +1117,14 @@ namespace v2rayN
Directory.CreateDirectory(_tempPath); Directory.CreateDirectory(_tempPath);
} }
} }
return Path.Combine(_tempPath, filename); if (string.IsNullOrEmpty(filename))
{
return _tempPath;
}
else
{
return Path.Combine(_tempPath, filename);
}
} }
public static string GetLogPath(string filename = "") public static string GetLogPath(string filename = "")
{ {