eumario / godot-manager

A Project, Version and Addons/Plugins manager for Godot Game Engine.
MIT License
332 stars 19 forks source link

Setting the path to Documents results in immediate permission crash #56

Closed IXLLEGACYIXL closed 10 months ago

IXLLEGACYIXL commented 1 year ago

Describe the bug setting project path to C:\Users\bla\Documents\ results in immediate crash as the manager doesnt have permissions for "My Pictures" folder to scan

To Reproduce install it set project source folder path to C:\Users\blabla\Documents\ click on open/scan project

Expected behavior should just ignore the folder where it doesnt have permissions to

Screenshots


OpenGL ES 3.0 Renderer: NVIDIA GeForce RTX 3050/PCIe/SSE2
Async. shader compilation: OFF

Mono: Log file is: 'C:/Users/ixlle/AppData/Roaming/Godot-Manager/mono/mono_logs/2023-01-03_13.35.32_4768.log'

Unhandled Exception:
System.AggregateException: One or more errors occurred. (Access to the path 'C:\Users\ixlle\Documents\Eigene Bilder' is denied.) ---> System.UnauthorizedAccessException: Access to the path 'C:\Users\ixlle\Documents\Eigene Bilder' is denied.
  at System.IO.Enumeration.FileSystemEnumerator`1[TResult].CreateRelativeDirectoryHandle (System.ReadOnlySpan`1[T] relativePath, System.String fullPath) [0x0004b] in <c84d94161bca414384015e66544862cf>:0
  at System.IO.Enumeration.FileSystemEnumerator`1[TResult].MoveNext () [0x00158] in <c84d94161bca414384015e66544862cf>:0
  at ProjectsPanel.ScanDirectories (Godot.Collections.Array`1[T] scanDirs) [0x000b6] in <c76ad5d95438420fb559050a45690409>:0
   --- End of inner exception stack trace ---
  at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00011] in <c84d94161bca414384015e66544862cf>:0
  at System.Threading.Tasks.Task`1[TResult].GetResultCore (System.Boolean waitCompletionNotification) [0x0002b] in <c84d94161bca414384015e66544862cf>:0
  at System.Threading.Tasks.Task`1[TResult].get_Result () [0x0000f] in <c84d94161bca414384015e66544862cf>:0
  at ProjectsPanel.ScanForProjects () [0x00240] in <c76ad5d95438420fb559050a45690409>:0
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) [0x00000] in <c84d94161bca414384015e66544862cf>:0
  at Godot.GodotSynchronizationContext.ExecutePendingContinuations () [0x0001d] in <d0b7d6b6d74e4318be3dfcff5c3b7c05>:0
  at Godot.GodotTaskScheduler.Activate () [0x0000c] in <d0b7d6b6d74e4318be3dfcff5c3b7c05>:0
  at (wrapper native-to-managed) Godot.GodotTaskScheduler.Activate(Godot.GodotTaskScheduler,System.Exception&)
---> (Inner Exception #0) System.UnauthorizedAccessException: Access to the path 'C:\Users\ixlle\Documents\Eigene Bilder' is denied.
  at System.IO.Enumeration.FileSystemEnumerator`1[TResult].CreateRelativeDirectoryHandle (System.ReadOnlySpan`1[T] relativePath, System.String fullPath) [0x0004b] in <c84d94161bca414384015e66544862cf>:0
  at System.IO.Enumeration.FileSystemEnumerator`1[TResult].MoveNext () [0x00158] in <c84d94161bca414384015e66544862cf>:0

  at ProjectsPanel.ScanDirectories (Godot.Collections.Array`1[T] scanDirs) [0x000b6] in <c76ad5d95438420fb559050a45690409>:0 <---

Unhandled Exception:
System.AggregateException: One or more errors occurred. (Access to the path 'C:\Users\ixlle\Documents\Eigene Bilder' is denied.) ---> System.UnauthorizedAccessException: Access to the path 'C:\Users\ixlle\Documents\Eigene Bilder' is denied.
  at System.IO.Enumeration.FileSystemEnumerator`1[TResult].CreateRelativeDirectoryHandle (System.ReadOnlySpan`1[T] relativePath, System.String fullPath) [0x0004b] in <c84d94161bca414384015e66544862cf>:0
  at System.IO.Enumeration.FileSystemEnumerator`1[TResult].MoveNext () [0x00158] in <c84d94161bca414384015e66544862cf>:0

  at ProjectsPanel.ScanDirectories (Godot.Collections.Array`1[T] scanDirs) [0x000b6] in <c76ad5d95438420fb559050a45690409>:0
   --- End of inner exception stack trace ---
  at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00011] in <c84d94161bca414384015e66544862cf>:0
  at System.Threading.Tasks.Task`1[TResult].GetResultCore (System.Boolean waitCompletionNotification) [0x0002b] in <c84d94161bca414384015e66544862cf>:0
  at System.Threading.Tasks.Task`1[TResult].get_Result () [0x0000f] in <c84d94161bca414384015e66544862cf>:0
  at ProjectsPanel.ScanForProjects () [0x00240] in <c76ad5d95438420fb559050a45690409>:0
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) [0x00000] in <c84d94161bca414384015e66544862cf>:0
  at Godot.GodotSynchronizationContext.ExecutePendingContinuations () [0x0001d] in <d0b7d6b6d74e4318be3dfcff5c3b7c05>:0
  at Godot.GodotTaskScheduler.Activate () [0x0000c] in <d0b7d6b6d74e4318be3dfcff5c3b7c05>:0
  at (wrapper native-to-managed) Godot.GodotTaskScheduler.Activate(Godot.GodotTaskScheduler,System.Exception&)
---> (Inner Exception #0) System.UnauthorizedAccessException: Access to the path 'C:\Users\ixlle\Documents\Eigene Bilder' is denied.
  at System.IO.Enumeration.FileSystemEnumerator`1[TResult].CreateRelativeDirectoryHandle (System.ReadOnlySpan`1[T] relativePath, System.String fullPath) [0x0004b] in <c84d94161bca414384015e66544862cf>:0
  at System.IO.Enumeration.FileSystemEnumerator`1[TResult].MoveNext () [0x00158] in <c84d94161bca414384015e66544862cf>:0

  at ProjectsPanel.ScanDirectories (Godot.Collections.Array`1[T] scanDirs) [0x000b6] in <c76ad5d95438420fb559050a45690409>:0 <--```

**Complete the Following:**
 - OS: Windows and probably other OS but normal people dont play that much with Linux permissions to see the Error happening
 - Version [e.g. 22]

**Additional context**
checking if the program has access to a folder before and if it hasnt then just ignoring it would be better than letting it crash
IXLLEGACYIXL commented 1 year ago

related to issue #54 just from the windows perspective and it happens on multiple locations like import,scan,open...

eumario commented 1 year ago

This is not related to issue #54, as it is a different problem. #54 is not appending the project.godot to the end of the path, where as this is specifically the filesystem denying access to the folder to read the contents of the folder. This will be fixed in 0.3.0, as I will be strictly using .NET API for Filesystem, instead of a mixture of Godot and .NET API.

eumario commented 10 months ago

Commit 8c72f69 fixes bug. Permissions issue, be it Windows, Linux or Mac OS, .NET 4.7.2's EnumerateDirectories/EnumerateFiles does not allow for Exceptions and continuations. Re-Wrote function to use Godot functionality for now, till 0.3.0, which will use Dotnet 6/7/8.