Fix child population of archive directories
This commit is contained in:
parent
63df396fad
commit
8d399d11e6
1 changed files with 5 additions and 3 deletions
|
@ -10,15 +10,17 @@ namespace LANCommander.Components.FileManagerComponents
|
||||||
|
|
||||||
public void PopulateChildren(IEnumerable<ZipArchiveEntry> entries)
|
public void PopulateChildren(IEnumerable<ZipArchiveEntry> entries)
|
||||||
{
|
{
|
||||||
var childPaths = entries.Where(e => e.FullName.StartsWith("/") && e.FullName.EndsWith('/'));
|
var path = Path == "/" ? "" : Path;
|
||||||
var directChildren = childPaths.Where(p => p.FullName != Path && p.FullName.Substring(Path.Length + 1).TrimEnd('/').Split('/').Length == 1);
|
var childPaths = entries.Where(e => e.FullName.EndsWith('/'));
|
||||||
|
var directChildren = childPaths.Where(p => p.FullName != path && p.FullName.StartsWith(path) && p.FullName.Substring(path.Length).TrimEnd('/').Split('/').Length == 1);
|
||||||
|
|
||||||
foreach (var directChild in directChildren)
|
foreach (var directChild in directChildren)
|
||||||
{
|
{
|
||||||
var child = new FileManagerDirectory()
|
var child = new FileManagerDirectory()
|
||||||
{
|
{
|
||||||
Path = directChild.FullName,
|
Path = directChild.FullName,
|
||||||
Name = directChild.FullName.Substring(Path.Length).TrimEnd('/')
|
Name = directChild.FullName.Substring(path.Length).TrimEnd('/'),
|
||||||
|
Parent = this
|
||||||
};
|
};
|
||||||
|
|
||||||
child.PopulateChildren(entries);
|
child.PopulateChildren(entries);
|
||||||
|
|
Loading…
Add table
Reference in a new issue