Skip to content

Commit

Permalink
Fixed Get directory listing with subdirectory.
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesbetros committed Mar 25, 2016
1 parent 89d0217 commit 653b7a8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
8 changes: 4 additions & 4 deletions Tests/Cosmos.Kernel.Tests.Fat/Kernel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ protected override void Run()
mDebugger.Send("Run");

TestPath();
//TestDirectory();
//TestFile();
//TestFileStream();
TestDirectory();
TestFile();
TestFileStream();

TestController.Completed();
}
Expand Down Expand Up @@ -797,4 +797,4 @@ private bool StringArrayAreEquals(string[] a1, string[] a2)
#endregion

}
}
}
6 changes: 3 additions & 3 deletions source/Cosmos.System/FileSystem/CosmosVFS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -392,14 +392,14 @@ private DirectoryEntry DoGetDirectoryEntry(string aPath, FileSystem aFS)

string[] xPathParts = VFSManager.SplitPath(aPath);

DirectoryEntry xBaseDirectory = GetVolume(aFS);

if (xPathParts.Length == 1)
{
Global.mFileSystemDebugger.SendInternal("Returning the volume.");
return GetVolume(aFS);
return xBaseDirectory;
}

DirectoryEntry xBaseDirectory = null;

// start at index 1, because 0 is the volume
for (int i = 1; i < xPathParts.Length; i++)
{
Expand Down
11 changes: 7 additions & 4 deletions source/Cosmos.System/FileSystem/FAT/FatFileSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -608,13 +608,16 @@ public override List<DirectoryEntry> GetDirectoryListing(DirectoryEntry baseDire
{
Global.mFileSystemDebugger.SendInternal("FatFileSystem.GetDirectoryListing:");

var result = new List<DirectoryEntry>();
List<FatDirectoryEntry> fatListing;
if (baseDirectory == null)
{
var xEntry = (FatDirectoryEntry)baseDirectory;
fatListing = xEntry.ReadDirectoryContents();
throw new ArgumentNullException(nameof(baseDirectory));
}

var result = new List<DirectoryEntry>();
var xEntry = (FatDirectoryEntry)baseDirectory;
var fatListing = xEntry.ReadDirectoryContents();
Global.mFileSystemDebugger.SendInternal("After ReadDirectoryContents");

for (int i = 0; i < fatListing.Count; i++)
{
result.Add(fatListing[i]);
Expand Down

0 comments on commit 653b7a8

Please sign in to comment.