From f0d6fcab1b5aa8ca34c58301877391c57b70c5ca Mon Sep 17 00:00:00 2001 From: Mike Phares Date: Thu, 29 Jun 2023 22:56:36 -0700 Subject: [PATCH] Relative --- Save-Image-Info/SaveImageInfo.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Save-Image-Info/SaveImageInfo.cs b/Save-Image-Info/SaveImageInfo.cs index 4bac9c5..8176665 100644 --- a/Save-Image-Info/SaveImageInfo.cs +++ b/Save-Image-Info/SaveImageInfo.cs @@ -60,7 +60,7 @@ public class SaveImageInfo { } } - private static StringBuilder GetLines(ProgressBar progressBar, List filesCollection) + private StringBuilder GetLines(ProgressBar progressBar, List filesCollection) { StringBuilder result = new(); string json; @@ -68,6 +68,7 @@ public class SaveImageInfo ImageInfo imageInfo; FileHolder[] fileHolders; List lines = new(); + int rootDirectoryLength = _PropertyConfiguration.RootDirectory.Length; foreach (string[] files in filesCollection) { lines.Clear(); @@ -84,9 +85,9 @@ public class SaveImageInfo if (lines.Any()) { directory = Path.GetDirectoryName(files.First()); - if (directory is null) + if (directory is null || directory.Length < rootDirectoryLength) continue; - _ = result.AppendLine(directory); + _ = result.AppendLine(directory[rootDirectoryLength..]); foreach (string line in lines) _ = result.AppendLine(line); }