Displays directory access error in file system resource manager.
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
using Cryville.Common;
|
||||
using Cryville.Crtr.UI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security;
|
||||
|
||||
namespace Cryville.Crtr.Browsing {
|
||||
internal class FileSystemResourceManager : IPathedResourceManager<FileSystemEntry> {
|
||||
@@ -57,10 +59,20 @@ namespace Cryville.Crtr.Browsing {
|
||||
#error No root path handling logic
|
||||
#endif
|
||||
_cd = new DirectoryInfo(path);
|
||||
try {
|
||||
_items = _cd.GetFileSystemInfos()
|
||||
.Where(i => i is DirectoryInfo || _extFilter.Contains(i.Extension))
|
||||
.Select(i => new FileSystemEntry(i)).ToArray();
|
||||
}
|
||||
catch (SecurityException ex) {
|
||||
Popup.CreateException(ex);
|
||||
return;
|
||||
}
|
||||
catch (UnauthorizedAccessException ex) {
|
||||
Popup.CreateException(ex);
|
||||
return;
|
||||
}
|
||||
}
|
||||
ApplyFilter();
|
||||
DirectoryChanged?.Invoke();
|
||||
}
|
||||
|
Reference in New Issue
Block a user