@@ -106,7 +106,7 @@ public void OpenFile(NSMenuItem menuItem)
106
106
openPanel . CanChooseDirectories = false ;
107
107
openPanel . AllowsMultipleSelection = true ;
108
108
openPanel . AllowedFileTypes = new string [ ] { "xci" , "nsp" } ;
109
- openPanel . DirectoryUrl = new NSUrl ( Common . Settings . Default . InitialDirectory ?? "" ) ;
109
+ openPanel . DirectoryUrl = new NSUrl ( ! String . IsNullOrEmpty ( Common . Settings . Default . InitialDirectory ) && Directory . Exists ( Common . Settings . Default . InitialDirectory ) ? Common . Settings . Default . InitialDirectory : Environment . GetFolderPath ( Environment . SpecialFolder . UserProfile ) ) ;
110
110
111
111
Process . log ? . WriteLine ( "\n Open File" ) ;
112
112
@@ -153,7 +153,7 @@ public void OpenDirectory(NSMenuItem menuItem)
153
153
NSOpenPanel openPanel = NSOpenPanel . OpenPanel ;
154
154
openPanel . CanChooseFiles = false ;
155
155
openPanel . CanChooseDirectories = true ;
156
- openPanel . DirectoryUrl = new NSUrl ( Common . Settings . Default . InitialDirectory ?? "" ) ;
156
+ openPanel . DirectoryUrl = new NSUrl ( ! String . IsNullOrEmpty ( Common . Settings . Default . InitialDirectory ) && Directory . Exists ( Common . Settings . Default . InitialDirectory ) ? Common . Settings . Default . InitialDirectory : Environment . GetFolderPath ( Environment . SpecialFolder . UserProfile ) ) ;
157
157
158
158
Process . log ? . WriteLine ( "\n Open Directory" ) ;
159
159
@@ -230,7 +230,7 @@ public void OpenSDCard(NSMenuItem menuItem)
230
230
NSOpenPanel openPanel = NSOpenPanel . OpenPanel ;
231
231
openPanel . CanChooseFiles = false ;
232
232
openPanel . CanChooseDirectories = true ;
233
- openPanel . DirectoryUrl = new NSUrl ( Common . Settings . Default . InitialDirectory ?? "" ) ;
233
+ openPanel . DirectoryUrl = new NSUrl ( ! String . IsNullOrEmpty ( Common . Settings . Default . SDCardDirectory ) && Directory . Exists ( Common . Settings . Default . SDCardDirectory ) ? Common . Settings . Default . SDCardDirectory : Environment . GetFolderPath ( Environment . SpecialFolder . UserProfile ) ) ;
234
234
235
235
Process . log ? . WriteLine ( "\n Open SD Card" ) ;
236
236
@@ -241,7 +241,7 @@ public void OpenSDCard(NSMenuItem menuItem)
241
241
tableViewDataSource . Titles . Clear ( ) ;
242
242
tableView . ReloadData ( ) ;
243
243
244
- Common . Settings . Default . InitialDirectory = openPanel . Urls . First ( ) . Path ;
244
+ Common . Settings . Default . SDCardDirectory = openPanel . Urls . First ( ) . Path ;
245
245
Common . Settings . Default . Save ( ) ;
246
246
247
247
title . StringValue = String . Format ( "Opening SD card on {0}" , openPanel . Urls . First ( ) . Path ) ;
0 commit comments