summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Rhea.Nar/NarWriter.cs21
1 files changed, 5 insertions, 16 deletions
diff --git a/Rhea.Nar/NarWriter.cs b/Rhea.Nar/NarWriter.cs

index 52bbb0e..963afec 100644 --- a/Rhea.Nar/NarWriter.cs +++ b/Rhea.Nar/NarWriter.cs
@@ -31,7 +31,7 @@ public class NarWriter foreach (var chunk in GetNarSymlinkContents(fe)) yield return chunk; } - + private IEnumerable<byte[]> GetNarStreamContentsInner(FileSystemInfo fsi) { if (string.IsNullOrWhiteSpace(fsi.LinkTarget)) @@ -40,12 +40,10 @@ public class NarWriter foreach (var chunk in GetNarDirectoryContents(di)) yield return chunk; else - foreach (var chunk in GetNarFileContents(fsi as FileInfo ?? throw new Exception(fsi.GetType().Name +" != FileInfo"))) + foreach (var chunk in GetNarFileContents(fsi as FileInfo ?? throw new Exception(fsi.GetType().Name + " != FileInfo"))) yield return chunk; } - else - foreach (var chunk in GetNarSymlinkContents(fsi)) - yield return chunk; + else yield return GetNarSymlinkContents(fsi); } private IEnumerable<byte[]> GetNarDirectoryContents(DirectoryInfo de) @@ -68,18 +66,9 @@ public class NarWriter yield return NarConsts.RightParen; } - private IEnumerable<byte[]> GetNarSymlinkContents(FileSystemInfo fe) + private byte[] GetNarSymlinkContents(FileSystemInfo fe) { - // yield return NarConsts.LeftParen; - // - // yield return NarConsts.Type; - // yield return NarConsts.Symlink; - // yield return NarConsts.Target; - // yield return GetLengthPrefixedPadded(fe.LinkTarget!.AsBytes().ToArray()); - // - // yield return NarConsts.RightParen; - - yield return + return [ ..NarConsts.LeftParen,