Skip to content

Commit 1c18291

Browse files
committed
Fix: Fixed an issue where Recycle Bin showed file system hierarchy in Column View
1 parent 9ec5a71 commit 1c18291

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

src/Files.App/Views/Layouts/ColumnsLayoutPage.xaml.cs

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,34 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
103103
var path = navigationArguments.NavPathParam;
104104
var pathRoot = GetPathRoot(path);
105105
var pathStack = new Stack<string>();
106+
var storageTrashBinService = Ioc.Default.GetRequiredService<IStorageTrashBinService>();
107+
if (storageTrashBinService.IsUnderTrashBin(path))
108+
{
109+
var recycleBinPath = $"{pathRoot}$Recycle.Bin";
110+
var tempPath = path;
111+
var pathsToAdd = new List<string>();
112+
113+
while (!string.IsNullOrEmpty(tempPath))
114+
{
115+
var parentPath = GetParentDir(tempPath);
116+
117+
if (!string.IsNullOrEmpty(parentPath) && parentPath.Equals(recycleBinPath, StringComparison.OrdinalIgnoreCase))
118+
// SID folder? stop here
119+
break;
120+
121+
if (tempPath.Equals(recycleBinPath, StringComparison.OrdinalIgnoreCase))
122+
break;
106123

107-
if (!string.IsNullOrEmpty(pathRoot))
124+
pathsToAdd.Add(tempPath);
125+
tempPath = parentPath;
126+
}
127+
128+
foreach (var pathToAdd in pathsToAdd)
129+
pathStack.Push(pathToAdd);
130+
131+
path = Constants.UserEnvironmentPaths.RecycleBinPath;
132+
}
133+
else if (!string.IsNullOrEmpty(pathRoot))
108134
{
109135
var rootPathList = App.QuickAccessManager.Model.PinnedFolders.Select(NormalizePath)
110136
.Concat(CloudDrivesManager.Drives.Select(x => NormalizePath(x.Path))).ToList()

0 commit comments

Comments
 (0)