From 8bfd981a50526768f0c0b17f5edc444fc4ff8cbf Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Mon, 17 Sep 2018 21:05:28 -0400 Subject: [PATCH] Handle directory checking before entering task --- osu.Game/Database/ArchiveModelManager.cs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index ee9bf70aeb..06a8b490ef 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -438,19 +438,14 @@ namespace osu.Game.Database return Task.CompletedTask; } - return Task.Factory.StartNew(() => + if (!stable.ExistsDirectory(ImportFromStablePath)) { - try - { - Import(stable.GetDirectories(ImportFromStablePath).Select(f => stable.GetFullPath(f)).ToArray()); - } - catch (DirectoryNotFoundException) - { - // This handles situations like when the user does not have a Skins folder - // which would have this exception thrown from stable.GetDirectories - Logger.Log("No " + ImportFromStablePath + " folder available in osu!stable installation", LoggingTarget.Information, LogLevel.Error); - } - }, TaskCreationOptions.LongRunning); + // This handles situations like when the user does not have a Skins folder + Logger.Log("No " + ImportFromStablePath + " folder available in osu!stable installation", LoggingTarget.Information, LogLevel.Error); + return Task.CompletedTask; + } + + return Task.Factory.StartNew(() => Import(stable.GetDirectories(ImportFromStablePath).Select(f => stable.GetFullPath(f)).ToArray()), TaskCreationOptions.LongRunning); } #endregion