Skip to content

Commit

Permalink
fix cpio reader
Browse files Browse the repository at this point in the history
  • Loading branch information
teplofizik committed Oct 12, 2022
1 parent 30c2d83 commit 5db79c6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions NyaFs/Filesystem/Cpio/CpioFsBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using NyaFs.Filesystem.Universal;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;

namespace NyaFs.Filesystem.Cpio
Expand Down
4 changes: 3 additions & 1 deletion NyaFs/Filesystem/Cpio/CpioFsReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public string ReadLink(string Path)
{
if (UnifyPath(N.Path) == UnifyPath(Path))
{
if (N.FileType == Types.CpioModeFileType.C_ISREG)
if (N.FileType == Types.CpioModeFileType.C_ISLNK)
return UTF8Encoding.UTF8.GetString(N.Content);
else
return null;
Expand Down Expand Up @@ -124,6 +124,8 @@ public FilesystemEntry[] ReadDir(string Path)
Pos = Pos + Path.Length + 1;
if((Pos < UPath.Length) && UPath.IndexOf('/', Pos) < 0)
{
if ((Path.Length > 0) && UPath[Path.Length] != '/') continue;

Res.Add(new FilesystemEntry(N.FsType, UPath, N.UserId, N.GroupId, N.HexMode, Convert.ToUInt32(N.Content.Length)));
}
}
Expand Down

0 comments on commit 5db79c6

Please sign in to comment.