Add environment variables to geo files

pull/3234/head
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);
//});
string targetPath = Utils.GetBinPath($"{geoName}.dat");
File.Copy(fileName, targetPath, true); 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,8 +1117,15 @@ namespace v2rayN
Directory.CreateDirectory(_tempPath); Directory.CreateDirectory(_tempPath);
} }
} }
if (string.IsNullOrEmpty(filename))
{
return _tempPath;
}
else
{
return Path.Combine(_tempPath, filename); return Path.Combine(_tempPath, filename);
} }
}
public static string GetLogPath(string filename = "") public static string GetLogPath(string filename = "")
{ {
string _tempPath = Path.Combine(StartupPath(), "guiLogs"); string _tempPath = Path.Combine(StartupPath(), "guiLogs");