Skip to content

Commit

Permalink
Fixed file browser not showing any contents in a folder if it contain…
Browse files Browse the repository at this point in the history
…s a system-protected file/folder (happened with '.android_secure' folder on Android)
  • Loading branch information
yasirkula committed Nov 9, 2023
1 parent 62d49ea commit 5b0c08e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Plugins/SimpleFileBrowser/README.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= Simple File Browser (v1.6.2) =
= Simple File Browser (v1.6.3) =

Documentation: https://github.com/yasirkula/UnitySimpleFileBrowser
FAQ: https://github.com/yasirkula/UnitySimpleFileBrowser#faq
Expand Down
23 changes: 19 additions & 4 deletions Plugins/SimpleFileBrowser/Scripts/FileBrowserHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -239,14 +239,29 @@ public static FileSystemEntry[] GetEntriesInDirectory( string path, bool extract

try
{
FileSystemInfo[] items = new DirectoryInfo( path ).GetFileSystemInfos();
FileSystemEntry[] result = new FileSystemEntry[items.Length];
string[] files = Directory.GetFiles( path );
string[] subDirectories = Directory.GetDirectories( path );
FileSystemEntry[] result = new FileSystemEntry[files.Length + subDirectories.Length];
int index = 0;
for( int i = 0; i < items.Length; i++ )
for( int i = 0; i < files.Length; i++ )
{
try
{
result[index] = new FileSystemEntry( items[i], FileBrowser.GetExtensionFromFilename( items[i].Name, extractOnlyLastSuffixFromExtensions ) );
FileInfo fileInfo = new FileInfo( files[i] );
result[index] = new FileSystemEntry( fileInfo, FileBrowser.GetExtensionFromFilename( fileInfo.Name, extractOnlyLastSuffixFromExtensions ) );
index++;
}
catch( System.Exception e )
{
Debug.LogException( e );
}
}

for( int i = 0; i < subDirectories.Length; i++ )
{
try
{
result[index] = new FileSystemEntry( new DirectoryInfo( subDirectories[i] ), string.Empty );
index++;
}
catch( System.Exception e )
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "com.yasirkula.simplefilebrowser",
"displayName": "Simple File Browser",
"version": "1.6.2",
"version": "1.6.3",
"documentationUrl": "https://github.com/yasirkula/UnitySimpleFileBrowser",
"changelogUrl": "https://github.com/yasirkula/UnitySimpleFileBrowser/releases",
"licensesUrl": "https://github.com/yasirkula/UnitySimpleFileBrowser/blob/master/LICENSE.txt",
Expand Down

0 comments on commit 5b0c08e

Please sign in to comment.