Handle exception thrown due to custom stoage on startup

This commit is contained in:
smoogipoo 2020-07-01 17:47:29 +09:00
parent ab15b6031d
commit cdcad94e9f
1 changed files with 11 additions and 1 deletions

View File

@ -34,8 +34,18 @@ public OsuStorage(GameHost host, Storage defaultStorage)
var customStoragePath = storageConfig.Get<string>(StorageConfig.FullPath);
if (!string.IsNullOrEmpty(customStoragePath))
{
try
{
ChangeTargetStorage(host.GetStorage(customStoragePath));
}
catch (Exception ex)
{
Logger.Log($"Couldn't use custom storage path ({customStoragePath}): {ex}. Using default path.", LoggingTarget.Runtime, LogLevel.Error);
ChangeTargetStorage(defaultStorage);
}
}
}
protected override void ChangeTargetStorage(Storage newStorage)
{