Reverted and fixed the source code.

This commit is contained in:
Ikuo Ohba 2024-05-05 12:12:40 +09:00
parent 332e528012
commit d047d26dbf

View File

@ -760,13 +760,23 @@ namespace Oqtane.Controllers
{ {
if (!Directory.Exists(folderpath)) if (!Directory.Exists(folderpath))
{ {
try string path = folderpath.StartsWith(Path.DirectorySeparatorChar) ? Path.DirectorySeparatorChar.ToString() : string.Empty;
var separators = new char[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar };
string[] folders = folderpath.Split(separators, StringSplitOptions.RemoveEmptyEntries);
foreach (string folder in folders)
{ {
Directory.CreateDirectory(folderpath); path = Utilities.PathCombine(path, folder, Path.DirectorySeparatorChar.ToString());
} if (!Directory.Exists(path))
catch (Exception ex) {
{ try
_logger.Log(LogLevel.Error, this, LogFunction.Create, ex, "Unable To Create Folder {Folder}", folderpath); {
Directory.CreateDirectory(path);
}
catch (Exception ex)
{
_logger.Log(LogLevel.Error, this, LogFunction.Create, ex, "Unable To Create Folder {Folder}", path);
}
}
} }
} }
} }