diff --git a/osu.Framework/Graphics/UserInterface/DirectorySelector.cs b/osu.Framework/Graphics/UserInterface/DirectorySelector.cs index 228e5a7d87..f37b4aa620 100644 --- a/osu.Framework/Graphics/UserInterface/DirectorySelector.cs +++ b/osu.Framework/Graphics/UserInterface/DirectorySelector.cs @@ -11,6 +11,7 @@ using osu.Framework.Bindables; using osu.Framework.Extensions.EnumExtensions; using osu.Framework.Graphics.Containers; +using osu.Framework.Logging; using osu.Framework.Platform; using osuTK; @@ -204,10 +205,19 @@ protected virtual bool TryGetEntriesForPath(DirectoryInfo path, out ICollection< try { - foreach (var dir in path.GetDirectories().OrderBy(d => d.Name)) + foreach (string directoryName in Directory.GetDirectories(path.FullName).OrderBy(d => d)) { - if (ShowHiddenItems.Value || !dir.Attributes.HasFlagFast(FileAttributes.Hidden)) - items.Add(CreateDirectoryItem(dir)); + try + { + DirectoryInfo di = new DirectoryInfo(directoryName); + if (ShowHiddenItems.Value || !di.Attributes.HasFlagFast(FileAttributes.Hidden)) + items.Add(CreateDirectoryItem(di)); + } + catch + { + // Don't fail enumeration if we fail getting attributes for a single entry + Logger.Log($"Directory {directoryName} is inaccessible", LoggingTarget.Information, LogLevel.Debug); + } } return true;