mirror of
https://github.com/claunia/romrepomgr.git
synced 2025-12-16 19:24:51 +00:00
Move reading root directory to VFS.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user