OS independent file paths & Utility.PathCombine added

System.IO.Path.Combine provides cross-platform support for system paths, however rooted paths discarding of earlier segments
Utilities.PathCombine ensures if any parameters start with root chacters does not discard previous Utilities.PathCombine allows appending of "\\" to translate to the correct cross-platform result
This commit is contained in:
Sean Long
2020-04-18 14:57:31 -04:00
parent 194f5674b4
commit f0043f53ee
11 changed files with 37 additions and 18 deletions

View File

@ -110,7 +110,7 @@ namespace Oqtane.Controllers
if (string.IsNullOrEmpty(folder.Path) && folder.ParentId != null)
{
Folder parent = _folders.GetFolder(folder.ParentId.Value);
folder.Path = Path.Combine(parent.Path, folder.Name);
folder.Path = Utilities.PathCombine(parent.Path, folder.Name,"\\");
}
folder = _folders.AddFolder(folder);
_logger.Log(LogLevel.Information, this, LogFunction.Create, "Folder Added {Folder}", folder);
@ -135,7 +135,7 @@ namespace Oqtane.Controllers
if (string.IsNullOrEmpty(folder.Path) && folder.ParentId != null)
{
Folder parent = _folders.GetFolder(folder.ParentId.Value);
folder.Path = Path.Combine(parent.Path, folder.Name);
folder.Path = Utilities.PathCombine(parent.Path, folder.Name,"\\");
}
folder = _folders.UpdateFolder(folder);
_logger.Log(LogLevel.Information, this, LogFunction.Update, "Folder Updated {Folder}", folder);