Portable Mode

This commit is contained in:
2dust
2022-04-13 19:58:15 +08:00
parent 88cfb8fcd5
commit 364586fac8

View File

@@ -81,7 +81,7 @@ namespace clashN.Handler
KillProcess(_process); KillProcess(_process);
_process.Dispose(); _process.Dispose();
_process = null; _process = null;
} }
else else
{ {
if (coreInfo == null || coreInfo.coreExes == null) if (coreInfo == null || coreInfo.coreExes == null)
@@ -179,12 +179,19 @@ namespace clashN.Handler
string fileName = FindCoreExe(coreInfo.coreExes); string fileName = FindCoreExe(coreInfo.coreExes);
if (fileName == "") return; if (fileName == "") return;
//Portable Mode
var arguments = coreInfo.arguments;
if (Directory.Exists(Utils.GetPath("data")))
{
arguments += $" -d {Utils.GetPath("")}";
}
Process p = new Process Process p = new Process
{ {
StartInfo = new ProcessStartInfo StartInfo = new ProcessStartInfo
{ {
FileName = fileName, FileName = fileName,
Arguments = coreInfo.arguments, Arguments = arguments,
WorkingDirectory = Utils.StartupPath(), WorkingDirectory = Utils.StartupPath(),
UseShellExecute = false, UseShellExecute = false,
RedirectStandardOutput = true, RedirectStandardOutput = true,