Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
2dust committed Jan 27, 2024
1 parent 6f22b74 commit bd83809
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
10 changes: 10 additions & 0 deletions v2rayN/v2rayN/Common/StringEx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,15 @@ public static string UpperFirstChar(this string value)

return char.ToUpper(value[0]) + value.Substring(1);
}

public static string AppendQuotes(this string value)
{
if (string.IsNullOrEmpty(value))
{
return string.Empty;
}

return $"\"{value}\"";
}
}
}
4 changes: 2 additions & 2 deletions v2rayN/v2rayN/Handler/UpdateHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void CheckUpdateGuiN(Config config, Action<bool, string> update, bool pre
StartInfo = new ProcessStartInfo
{
FileName = "v2rayUpgrade.exe",
Arguments = $"\"{fileName}\"",
Arguments = fileName.AppendQuotes(),
WorkingDirectory = Utils.StartupPath()
}
};
Expand Down Expand Up @@ -364,7 +364,7 @@ private SemanticVersion getCoreVersion(ECoreType type)
}

using Process p = new();
p.StartInfo.FileName = filePath;
p.StartInfo.FileName = filePath.AppendQuotes();
p.StartInfo.Arguments = coreInfo.versionArg;
p.StartInfo.WorkingDirectory = Utils.StartupPath();
p.StartInfo.UseShellExecute = false;
Expand Down
2 changes: 1 addition & 1 deletion v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1388,7 +1388,7 @@ private void RebootAsAdmin()
UseShellExecute = true,
Arguments = Global.RebootAs,
WorkingDirectory = Utils.StartupPath(),
FileName = Utils.GetExePath(),
FileName = Utils.GetExePath().AppendQuotes(),
Verb = "runas",
};
try
Expand Down

0 comments on commit bd83809

Please sign in to comment.