Skip to content

Commit ee185c6

Browse files
authored
Fix: Fixed an issue with launching programs from the Address Bar (#15459)
1 parent b52bb1b commit ee185c6

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/Files.App/ViewModels/UserControls/AddressToolbarViewModel.cs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -815,17 +815,10 @@ private void SavePathToHistory(string path)
815815

816816
private static async Task<bool> LaunchApplicationFromPath(string currentInput, string workingDir)
817817
{
818-
var trimmedInput = currentInput.Trim();
819-
var fileName = trimmedInput;
820-
var arguments = string.Empty;
821-
if (trimmedInput.Contains(' '))
822-
{
823-
var positionOfBlank = trimmedInput.IndexOf(' ');
824-
fileName = trimmedInput.Substring(0, positionOfBlank);
825-
arguments = currentInput.Substring(currentInput.IndexOf(' '));
826-
}
827-
828-
return await LaunchHelper.LaunchAppAsync(fileName, arguments, workingDir);
818+
var args = CommandLineParser.SplitArguments(currentInput);
819+
return await LaunchHelper.LaunchAppAsync(
820+
args.FirstOrDefault("").Trim('"'), string.Join(' ', args.Skip(1)), workingDir
821+
);
829822
}
830823

831824
public async Task SetAddressBarSuggestionsAsync(AutoSuggestBox sender, IShellPage shellpage)

0 commit comments

Comments
 (0)