pull/4711/head
2dust 2024-01-27 18:29:17 +08:00
parent 6f22b74154
commit bd838094cd
3 changed files with 13 additions and 3 deletions

View File

@ -80,5 +80,15 @@ namespace v2rayN
return char.ToUpper(value[0]) + value.Substring(1); return char.ToUpper(value[0]) + value.Substring(1);
} }
public static string AppendQuotes(this string value)
{
if (string.IsNullOrEmpty(value))
{
return string.Empty;
}
return $"\"{value}\"";
}
} }
} }

View File

@ -54,7 +54,7 @@ namespace v2rayN.Handler
StartInfo = new ProcessStartInfo StartInfo = new ProcessStartInfo
{ {
FileName = "v2rayUpgrade.exe", FileName = "v2rayUpgrade.exe",
Arguments = $"\"{fileName}\"", Arguments = fileName.AppendQuotes(),
WorkingDirectory = Utils.StartupPath() WorkingDirectory = Utils.StartupPath()
} }
}; };
@ -364,7 +364,7 @@ namespace v2rayN.Handler
} }
using Process p = new(); using Process p = new();
p.StartInfo.FileName = filePath; p.StartInfo.FileName = filePath.AppendQuotes();
p.StartInfo.Arguments = coreInfo.versionArg; p.StartInfo.Arguments = coreInfo.versionArg;
p.StartInfo.WorkingDirectory = Utils.StartupPath(); p.StartInfo.WorkingDirectory = Utils.StartupPath();
p.StartInfo.UseShellExecute = false; p.StartInfo.UseShellExecute = false;

View File

@ -1388,7 +1388,7 @@ namespace v2rayN.ViewModels
UseShellExecute = true, UseShellExecute = true,
Arguments = Global.RebootAs, Arguments = Global.RebootAs,
WorkingDirectory = Utils.StartupPath(), WorkingDirectory = Utils.StartupPath(),
FileName = Utils.GetExePath(), FileName = Utils.GetExePath().AppendQuotes(),
Verb = "runas", Verb = "runas",
}; };
try try