afrantzis/bless

Bless crashes when ~/.config/bless/plugins is a file instead of a directory

andrsmllr opened this issue · 0 comments

Hi,

when I first ran bless I received a message about the missing plugins folder:

$ bless
Could not find a part of the path '/home/username/.config/bless/plugins'.

To get rid of this message I wanted to create the folder, but accidentally created a file of the same name instead.
This scenario causes bless to crash when invoked:

$ touch ~/.config/bless/plugins
$ bless
Unhandled Exception:
System.IO.IOException: Not a directory
  at System.IO.Enumeration.FileSystemEnumerator`1[TResult].CreateDirectoryHandle (System.String path, System.Boolean ignoreNotFound) [0x00038] in <12b418a7818c4ca0893feeaaf67f1e7f>:0 
  at System.IO.Enumeration.FileSystemEnumerator`1[TResult]..ctor (System.String directory, System.IO.EnumerationOptions options) [0x0004e] in <12b418a7818c4ca0893feeaaf67f1e7f>:0 
  at System.IO.Enumeration.FileSystemEnumerable`1+DelegateEnumerator[TResult]..ctor (System.IO.Enumeration.FileSystemEnumerable`1[TResult] enumerable) [0x00000] in <12b418a7818c4ca0893feeaaf67f1e7f>:0 
  at System.IO.Enumeration.FileSystemEnumerable`1[TResult]..ctor (System.String directory, System.IO.Enumeration.FileSystemEnumerable`1+FindTransform[TResult] transform, System.IO.EnumerationOptions options) [0x0004b] in <12b418a7818c4ca0893feeaaf67f1e7f>:0 
  at System.IO.Enumeration.FileSystemEnumerableFactory.UserFiles (System.String directory, System.String expression, System.IO.EnumerationOptions options) [0x00014] in <12b418a7818c4ca0893feeaaf67f1e7f>:0 
  at System.IO.Directory.InternalEnumeratePaths (System.String path, System.String searchPattern, System.IO.SearchTarget searchTarget, System.IO.EnumerationOptions options) [0x00045] in <12b418a7818c4ca0893feeaaf67f1e7f>:0 
  at System.IO.Directory.GetFiles (System.String path, System.String searchPattern, System.IO.EnumerationOptions enumerationOptions) [0x00000] in <12b418a7818c4ca0893feeaaf67f1e7f>:0 
  at System.IO.Directory.GetFiles (System.String path) [0x0000b] in <12b418a7818c4ca0893feeaaf67f1e7f>:0 
  at Bless.Plugins.PluginManager..ctor (System.Type pluginType, System.Object[] args) [0x000dd] in <d27d9b4b882f4dee992f297ab2fa860e>:0 
  at Bless.Plugins.PluginManager.AddForType (System.Type pluginType, System.Object[] args) [0x00000] in <d27d9b4b882f4dee992f297ab2fa860e>:0 
  at BlessMain..ctor (System.String[] args) [0x00453] in <e2904a26df0348ae996849b2f4e8293c>:0 
  at BlessMain.Main (System.String[] args) [0x00000] in <e2904a26df0348ae996849b2f4e8293c>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.IOException: Not a directory
  at System.IO.Enumeration.FileSystemEnumerator`1[TResult].CreateDirectoryHandle (System.String path, System.Boolean ignoreNotFound) [0x00038] in <12b418a7818c4ca0893feeaaf67f1e7f>:0 
  at System.IO.Enumeration.FileSystemEnumerator`1[TResult]..ctor (System.String directory, System.IO.EnumerationOptions options) [0x0004e] in <12b418a7818c4ca0893feeaaf67f1e7f>:0 
  at System.IO.Enumeration.FileSystemEnumerable`1+DelegateEnumerator[TResult]..ctor (System.IO.Enumeration.FileSystemEnumerable`1[TResult] enumerable) [0x00000] in <12b418a7818c4ca0893feeaaf67f1e7f>:0 
  at System.IO.Enumeration.FileSystemEnumerable`1[TResult]..ctor (System.String directory, System.IO.Enumeration.FileSystemEnumerable`1+FindTransform[TResult] transform, System.IO.EnumerationOptions options) [0x0004b] in <12b418a7818c4ca0893feeaaf67f1e7f>:0 
  at System.IO.Enumeration.FileSystemEnumerableFactory.UserFiles (System.String directory, System.String expression, System.IO.EnumerationOptions options) [0x00014] in <12b418a7818c4ca0893feeaaf67f1e7f>:0 
  at System.IO.Directory.InternalEnumeratePaths (System.String path, System.String searchPattern, System.IO.SearchTarget searchTarget, System.IO.EnumerationOptions options) [0x00045] in <12b418a7818c4ca0893feeaaf67f1e7f>:0 
  at System.IO.Directory.GetFiles (System.String path, System.String searchPattern, System.IO.EnumerationOptions enumerationOptions) [0x00000] in <12b418a7818c4ca0893feeaaf67f1e7f>:0 
  at System.IO.Directory.GetFiles (System.String path) [0x0000b] in <12b418a7818c4ca0893feeaaf67f1e7f>:0 
  at Bless.Plugins.PluginManager..ctor (System.Type pluginType, System.Object[] args) [0x000dd] in <d27d9b4b882f4dee992f297ab2fa860e>:0 
  at Bless.Plugins.PluginManager.AddForType (System.Type pluginType, System.Object[] args) [0x00000] in <d27d9b4b882f4dee992f297ab2fa860e>:0 
  at BlessMain..ctor (System.String[] args) [0x00453] in <e2904a26df0348ae996849b2f4e8293c>:0 
  at BlessMain.Main (System.String[] args) [0x00000] in <e2904a26df0348ae996849b2f4e8293c>:0

I'm running Bless 0.6.0 on a Ubuntu (Focal) machine

$ uame -a
Linux mymachine 5.4.0-42-generic #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

The problem can obviously be fixed by creating a folder in ~/.config/bless/plugins instead of a file.
Opening a ticket anyway due to application crash caused by an unhandled exception.