fix: Cleans up file system paths and archiving (#815)
* Makes EnsureDirectory properly work for relative and absolute paths * Adds a `PathUtility.GetFullPath` which returns full paths for relative paths to `Core.BaseDirectory`. If the path is absolute, it will return as-is. * Moves EnsureDirectory to `PathUtility`. So `ScriptsHandler.EnsureDirectory` and `AssemblyHandler.EnsureDirectory` are now `PathUtility.EnsureDirectory` * Fixes crash guard so that it copies accounts properly. * Changes world save and auto archive to use a random folder name inside of the temp folder.
This commit is contained in:
parent
da31153b20
commit
a55e271a69
17 changed files with 447 additions and 341 deletions
|
|
@ -77,7 +77,7 @@ namespace Server.Engines.Spawners
|
|||
{
|
||||
var stemDir = stem[..^file.Name.Length];
|
||||
var fullOutputDir = Path.Combine(outputDir, stemDir);
|
||||
AssemblyHandler.EnsureDirectory(fullOutputDir);
|
||||
PathUtility.EnsureDirectory(fullOutputDir);
|
||||
|
||||
var outputFileName = $"{file.Name[..^file.Extension.Length]}.json";
|
||||
ParsePremiumSpawnerFile(file.FullName, Path.Combine(fullOutputDir, outputFileName), options);
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ namespace Server.Engines.Spawners
|
|||
if (!Path.IsPathRooted(path))
|
||||
{
|
||||
path = Path.Combine(Core.BaseDirectory, path);
|
||||
AssemblyHandler.EnsureDirectory(directory);
|
||||
PathUtility.EnsureDirectory(directory);
|
||||
}
|
||||
else if (!Directory.Exists(directory))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue