Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions src/Files.App/ViewModels/UserControls/AddressToolbarViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -720,30 +720,30 @@ await DialogDisplayHelper.ShowDialogAsync("CommandNotExecutable".GetLocalizedRes

var isFtp = FtpHelpers.IsFtpPath(currentInput);

currentInput = NormalizePathInput(currentInput, isFtp);
var normalizedInput = NormalizePathInput(currentInput, isFtp);

if (currentSelectedPath == currentInput || string.IsNullOrWhiteSpace(currentInput))
if (currentSelectedPath == normalizedInput || string.IsNullOrWhiteSpace(normalizedInput))
return;

if (currentInput != shellPage.FilesystemViewModel.WorkingDirectory || shellPage.CurrentPageType == typeof(HomePage))
if (normalizedInput != shellPage.FilesystemViewModel.WorkingDirectory || shellPage.CurrentPageType == typeof(HomePage))
{
if (currentInput.Equals("Home", StringComparison.OrdinalIgnoreCase) || currentInput.Equals("Home".GetLocalizedResource(), StringComparison.OrdinalIgnoreCase))
if (normalizedInput.Equals("Home", StringComparison.OrdinalIgnoreCase) || normalizedInput.Equals("Home".GetLocalizedResource(), StringComparison.OrdinalIgnoreCase))
{
SavePathToHistory("Home");
shellPage.NavigateHome();
}
else
{
currentInput = StorageFileExtensions.GetResolvedPath(currentInput, isFtp);
if (currentSelectedPath == currentInput)
normalizedInput = StorageFileExtensions.GetResolvedPath(normalizedInput, isFtp);
if (currentSelectedPath == normalizedInput)
return;

var item = await FilesystemTasks.Wrap(() => DriveHelpers.GetRootFromPathAsync(currentInput));
var item = await FilesystemTasks.Wrap(() => DriveHelpers.GetRootFromPathAsync(normalizedInput));

var resFolder = await FilesystemTasks.Wrap(() => StorageFileExtensions.DangerousGetFolderWithPathFromPathAsync(currentInput, item));
if (resFolder || FolderHelpers.CheckFolderAccessWithWin32(currentInput))
var resFolder = await FilesystemTasks.Wrap(() => StorageFileExtensions.DangerousGetFolderWithPathFromPathAsync(normalizedInput, item));
if (resFolder || FolderHelpers.CheckFolderAccessWithWin32(normalizedInput))
{
var matchingDrive = drivesViewModel.Drives.Cast<DriveItem>().FirstOrDefault(x => PathNormalization.NormalizePath(currentInput).StartsWith(PathNormalization.NormalizePath(x.Path), StringComparison.Ordinal));
var matchingDrive = drivesViewModel.Drives.Cast<DriveItem>().FirstOrDefault(x => PathNormalization.NormalizePath(normalizedInput).StartsWith(PathNormalization.NormalizePath(x.Path), StringComparison.Ordinal));
if (matchingDrive is not null && matchingDrive.Type == Data.Items.DriveType.CDRom && matchingDrive.MaxSpace == ByteSizeLib.ByteSize.FromBytes(0))
{
bool ejectButton = await DialogDisplayHelper.ShowDialogAsync("InsertDiscDialog/Title".GetLocalizedResource(), string.Format("InsertDiscDialog/Text".GetLocalizedResource(), matchingDrive.Path), "InsertDiscDialog/OpenDriveButton".GetLocalizedResource(), "Close".GetLocalizedResource());
Expand All @@ -754,18 +754,18 @@ await DialogDisplayHelper.ShowDialogAsync("CommandNotExecutable".GetLocalizedRes
}
return;
}
var pathToNavigate = resFolder.Result?.Path ?? currentInput;
var pathToNavigate = resFolder.Result?.Path ?? normalizedInput;
SavePathToHistory(pathToNavigate);
shellPage.NavigateToPath(pathToNavigate);
}
else if (isFtp)
{
SavePathToHistory(currentInput);
shellPage.NavigateToPath(currentInput);
SavePathToHistory(normalizedInput);
shellPage.NavigateToPath(normalizedInput);
}
else // Not a folder or inaccessible
{
var resFile = await FilesystemTasks.Wrap(() => StorageFileExtensions.DangerousGetFileWithPathFromPathAsync(currentInput, item));
var resFile = await FilesystemTasks.Wrap(() => StorageFileExtensions.DangerousGetFileWithPathFromPathAsync(normalizedInput, item));
if (resFile)
{
var pathToInvoke = resFile.Result.Path;
Expand Down