Browse Source
Merge pull request #20965 from abpframework/EngincanV/cmd-helper
CLI: CmdHelper should be working even the directory has 'space' characters
pull/20971/head
Berkan Sasmaz
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
5 additions and
1 deletions
-
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/CmdHelper.cs
|
|
@ -20,10 +20,14 @@ public class CmdHelper : ICmdHelper, ITransientDependency |
|
|
|
|
|
|
|
|
public void Open(string pathOrUrl) |
|
|
public void Open(string pathOrUrl) |
|
|
{ |
|
|
{ |
|
|
|
|
|
//directory might contain 'space' character
|
|
|
|
|
|
pathOrUrl = pathOrUrl.EnsureStartsWith('"'); |
|
|
|
|
|
pathOrUrl = pathOrUrl.EnsureEndsWith('"'); |
|
|
|
|
|
|
|
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) |
|
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) |
|
|
{ |
|
|
{ |
|
|
pathOrUrl = pathOrUrl.Replace("&", "^&"); |
|
|
pathOrUrl = pathOrUrl.Replace("&", "^&"); |
|
|
Process.Start(new ProcessStartInfo("cmd", $"/c start {pathOrUrl}") { CreateNoWindow = true }); |
|
|
Process.Start(new ProcessStartInfo("cmd", $"/c start \"\" {pathOrUrl}") { CreateNoWindow = true }); |
|
|
} |
|
|
} |
|
|
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) |
|
|
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) |
|
|
{ |
|
|
{ |
|
|
|