mirror of
https://github.com/ppy/osu.git
synced 2025-03-05 12:23:21 +08:00
Add very basic error handling when a directory cannot be enumerated
This commit is contained in:
parent
c048d9b6ae
commit
149cb93e8c
@ -16,6 +16,7 @@ using osu.Framework.Platform;
|
|||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterfaceV2
|
namespace osu.Game.Graphics.UserInterfaceV2
|
||||||
{
|
{
|
||||||
@ -74,22 +75,31 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
{
|
{
|
||||||
directoryFlow.Clear();
|
directoryFlow.Clear();
|
||||||
|
|
||||||
if (directory.NewValue == null)
|
try
|
||||||
{
|
{
|
||||||
var drives = DriveInfo.GetDrives();
|
if (directory.NewValue == null)
|
||||||
|
|
||||||
foreach (var drive in drives)
|
|
||||||
directoryFlow.Add(new DirectoryPiece(drive.RootDirectory));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
directoryFlow.Add(new ParentDirectoryPiece(currentDirectory.Value.Parent));
|
|
||||||
|
|
||||||
foreach (var dir in currentDirectory.Value.GetDirectories().OrderBy(d => d.Name))
|
|
||||||
{
|
{
|
||||||
if ((dir.Attributes & FileAttributes.Hidden) == 0)
|
var drives = DriveInfo.GetDrives();
|
||||||
directoryFlow.Add(new DirectoryPiece(dir));
|
|
||||||
|
foreach (var drive in drives)
|
||||||
|
directoryFlow.Add(new DirectoryPiece(drive.RootDirectory));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
directoryFlow.Add(new ParentDirectoryPiece(currentDirectory.Value.Parent));
|
||||||
|
|
||||||
|
foreach (var dir in currentDirectory.Value.GetDirectories().OrderBy(d => d.Name))
|
||||||
|
{
|
||||||
|
if ((dir.Attributes & FileAttributes.Hidden) == 0)
|
||||||
|
directoryFlow.Add(new DirectoryPiece(dir));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
currentDirectory.Value = directory.OldValue;
|
||||||
|
|
||||||
|
this.FlashColour(Color4.Red, 300);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user