Move reading root directory to VFS.

This commit is contained in:
2020-09-03 01:58:08 +01:00
parent 5229b88074
commit 9ce3f2213e
2 changed files with 9 additions and 21 deletions

View File

@@ -520,33 +520,13 @@ namespace RomRepoMgr.Core.Filesystem
{
if(directory == "/")
{
using var ctx = Context.Create(Settings.Settings.Current.DatabasePath);
List<DirectoryEntry> entries = new List<DirectoryEntry>
{
new DirectoryEntry("."),
new DirectoryEntry("..")
};
ConcurrentDictionary<string, long> rootCache = new ConcurrentDictionary<string, long>();
foreach(RomSet set in ctx.RomSets)
{
string name = set.Name.Replace('/', '');
if(entries.Any(e => e.Name == name))
name = Path.GetFileNameWithoutExtension(set.Filename)?.Replace('/', '');
if(entries.Any(e => e.Name == name) ||
name == null)
name = Path.GetFileNameWithoutExtension(set.Sha384);
if(name == null)
continue;
entries.Add(new DirectoryEntry(name));
rootCache[name] = set.Id;
}
entries.AddRange(_vfs.GetRootEntries().Select(e => new DirectoryEntry(e)));
_lastHandle++;
info.Handle = new IntPtr(_lastHandle);