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