Skip to content

Commit

Permalink
Merge pull request CosmosOS#2703 from GoldenretriverYT/iso9660fix
Browse files Browse the repository at this point in the history
Fix ISO9660
  • Loading branch information
quajak authored Jun 17, 2023
2 parents 4cc2475 + 5abe1e7 commit 67aaca8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
15 changes: 15 additions & 0 deletions source/Cosmos.System2/FileSystem/Disk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,21 @@ public List<ManagedPartition> Partitions
get
{
List<ManagedPartition> converted = new();

if(Host.Type == BlockDeviceType.RemovableCD) {
// we dont actually have a partition table in CDs
ManagedPartition part = new(new Partition(Host, 0, Host.BlockCount / 4)); // BlockSize is 512, SectorSize of ISO9660 usually is 2 2048

if (mountedPartitions[0] != null) {
var data = mountedPartitions[0];
part.RootPath = data.RootPath;
part.MountedFS = data;
}

converted.Add(part);
return converted;
}

if (GPT.IsGPTPartition(Host))
{
GPT gpt = new(Host);
Expand Down
8 changes: 5 additions & 3 deletions source/Cosmos.System2/FileSystem/ISO9660/ISO9660FileSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,16 +204,18 @@ public override List<DirectoryEntry> GetDirectoryListing(DirectoryEntry baseDire
foreach (var item in dirEntries)
{
DirectoryEntryTypeEnum type;
var fName = item.FileID;

if ((item.FileFlags & (1 << 1)) != 0)
{
type = DirectoryEntryTypeEnum.Directory;
}
else
{
type = DirectoryEntryTypeEnum.File;
type = DirectoryEntryTypeEnum.File; //remove the ;1 part from the file name
fName = fName.Remove(fName.Length - 2);
}
var properID = item.FileID.Remove(item.FileID.Length - 2); //remove the ;1 part from the file name
entries.Add(new ISO9660DirectoryEntry(item, this, parent, Path.Combine(parent.mFullPath, properID), properID, 0, type));
entries.Add(new ISO9660DirectoryEntry(item, this, parent, Path.Combine(parent.mFullPath, fName), fName, 0, type));
}
return entries;
}
Expand Down

0 comments on commit 67aaca8

Please sign in to comment.