using System; namespace FileCompression.Utils; public static class ArchiveUtils { public static string EntryFromPath(ReadOnlySpan path, bool appendPathSeparator = false) { // Remove leading separators. int nonSlash = path.IndexOfAnyExcept('/'); if (nonSlash < 0) { nonSlash = path.Length; } path = path.Slice(nonSlash); // Append a separator if necessary. return (path.IsEmpty, appendPathSeparator) switch { (false, false) => path.ToString(), (false, true) => string.Concat(path, "/"), (true, false) => string.Empty, (true, true) => "/", }; } }