From c48520b6cd7ee56c9f3fd94d50110a0674ba55ae Mon Sep 17 00:00:00 2001 From: rootdarkarchon Date: Wed, 28 Feb 2024 02:13:08 +0100 Subject: [PATCH] check if directory has subdirectories when setting storage location --- MareSynchronos/UI/UISharedService.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/MareSynchronos/UI/UISharedService.cs b/MareSynchronos/UI/UISharedService.cs index 3ca8c73..ac32170 100644 --- a/MareSynchronos/UI/UISharedService.cs +++ b/MareSynchronos/UI/UISharedService.cs @@ -603,7 +603,8 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase _isOneDrive = path.Contains("onedrive", StringComparison.OrdinalIgnoreCase); _isPenumbraDirectory = string.Equals(path.ToLowerInvariant(), _ipcManager.PenumbraModDirectory?.ToLowerInvariant(), StringComparison.Ordinal); _isDirectoryWritable = IsDirectoryWritable(path); - _cacheDirectoryHasOtherFilesThanCache = Directory.GetFiles(path, "*", SearchOption.AllDirectories).Any(f => Path.GetFileNameWithoutExtension(f).Length != 40); + _cacheDirectoryHasOtherFilesThanCache = Directory.GetFiles(path, "*", SearchOption.AllDirectories).Any(f => Path.GetFileNameWithoutExtension(f).Length != 40) + || Directory.GetDirectories(path).Any(); _cacheDirectoryIsValidPath = PathRegex().IsMatch(path); if (!string.IsNullOrEmpty(path) @@ -641,7 +642,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase } else if (_cacheDirectoryHasOtherFilesThanCache) { - ColorTextWrapped("Your selected directory has files inside that are not Loporrit related. Use an empty directory or a previous storage directory only.", ImGuiColors.DalamudRed); + ColorTextWrapped("Your selected directory has files or directories inside that are not Loporrit related. Use an empty directory or a previous storage directory only.", ImGuiColors.DalamudRed); } else if (!_cacheDirectoryIsValidPath) {