Fix bug if folder ended in trailing slash

This commit is contained in:
Michael Bucari-Tovo 2022-06-21 08:08:09 -06:00
parent 503379079b
commit 71387e94d8

View File

@ -18,7 +18,8 @@ namespace FileManager
/// <summary>Generate a valid path for this file or directory</summary> /// <summary>Generate a valid path for this file or directory</summary>
public LongPath GetFilePath(bool returnFirstExisting = false) public LongPath GetFilePath(bool returnFirstExisting = false)
{ {
string fileName = Template;
string fileName = Template.EndsWith(Path.DirectorySeparatorChar) ? Template[..^1] : Template;
List<string> pathParts = new(); List<string> pathParts = new();
var paramReplacements = ParameterReplacements.ToDictionary(r => $"<{formatKey(r.Key)}>", r => formatValue(r.Value)); var paramReplacements = ParameterReplacements.ToDictionary(r => $"<{formatKey(r.Key)}>", r => formatValue(r.Value));