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:
@ -431,12 +431,12 @@ namespace Oqtane.Controllers
|
||||
|
||||
private string GetFolderPath(Folder folder)
|
||||
{
|
||||
return Path.Combine(_environment.ContentRootPath, "Content", "Tenants", _tenants.GetTenant().TenantId.ToString(), "Sites", folder.SiteId.ToString(), folder.Path, " ").TrimEnd(' ');
|
||||
return Utilities.PathCombine(_environment.ContentRootPath, "Content", "Tenants", _tenants.GetTenant().TenantId.ToString(), "Sites", folder.SiteId.ToString(), folder.Path);
|
||||
}
|
||||
|
||||
private string GetFolderPath(string folder)
|
||||
{
|
||||
return Path.Combine(_environment.WebRootPath, folder, " ").TrimEnd(' ');
|
||||
return Utilities.PathCombine(_environment.WebRootPath, folder);
|
||||
}
|
||||
|
||||
private void CreateDirectory(string folderpath)
|
||||
@ -448,7 +448,7 @@ namespace Oqtane.Controllers
|
||||
string[] folders = folderpath.Split(separators, StringSplitOptions.RemoveEmptyEntries);
|
||||
foreach (string folder in folders)
|
||||
{
|
||||
path = Path.Combine(path, folder);
|
||||
path = Utilities.PathCombine(path, folder,"\\");
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
|
Reference in New Issue
Block a user