@@ -177,32 +177,30 @@ public void OpenTerminal(string workdir, string args)
177177 Process . Start ( startInfo ) ;
178178 }
179179
180- public void OpenInFileManager ( string path , bool select )
180+ public void OpenInFileManager ( string path )
181181 {
182- string fullpath ;
183182 if ( File . Exists ( path ) )
184183 {
185- fullpath = new FileInfo ( path ) . FullName ;
186- select = true ;
187- }
188- else
189- {
190- fullpath = new DirectoryInfo ( path ! ) . FullName ;
191- fullpath += Path . DirectorySeparatorChar ;
192- }
184+ var pidl = ILCreateFromPathW ( new FileInfo ( path ) . FullName ) ;
193185
194- if ( select )
195- {
196- OpenFolderAndSelectFile ( fullpath ) ;
197- }
198- else
199- {
200- Process . Start ( new ProcessStartInfo ( fullpath )
186+ try
187+ {
188+ SHOpenFolderAndSelectItems ( pidl , 0 , 0 , 0 ) ;
189+ }
190+ finally
201191 {
202- UseShellExecute = true ,
203- CreateNoWindow = true ,
204- } ) ;
192+ ILFree ( pidl ) ;
193+ }
194+
195+ return ;
205196 }
197+
198+ var dir = new DirectoryInfo ( path ) . FullName + Path . DirectorySeparatorChar ;
199+ Process . Start ( new ProcessStartInfo ( dir )
200+ {
201+ UseShellExecute = true ,
202+ CreateNoWindow = true ,
203+ } ) ;
206204 }
207205
208206 public void OpenWithDefaultEditor ( string file )
@@ -213,6 +211,7 @@ public void OpenWithDefaultEditor(string file)
213211 Process . Start ( start ) ;
214212 }
215213
214+ #region HELPER_METHODS
216215 private void FixWindowFrameOnWin10 ( Window w )
217216 {
218217 // Schedule the DWM frame extension to run in the next render frame
@@ -228,11 +227,22 @@ private void FixWindowFrameOnWin10(Window w)
228227 } , DispatcherPriority . Render ) ;
229228 }
230229
231- private PixelPoint IntPtrToPixelPoint ( IntPtr param )
230+ private List < Models . ExternalTool . LaunchOption > GenerateVSProjectLaunchOptions ( string path )
232231 {
233- var v = IntPtr . Size == 4 ? param . ToInt32 ( ) : ( int ) ( param . ToInt64 ( ) & 0xFFFFFFFF ) ;
234- return new PixelPoint ( ( short ) ( v & 0xffff ) , ( short ) ( v >> 16 ) ) ;
232+ var root = new DirectoryInfo ( path ) ;
233+ if ( ! root . Exists )
234+ return null ;
235+
236+ var options = new List < Models . ExternalTool . LaunchOption > ( ) ;
237+ root . WalkFiles ( f =>
238+ {
239+ if ( f . EndsWith ( ".sln" , StringComparison . OrdinalIgnoreCase ) ||
240+ f . EndsWith ( ".slnx" , StringComparison . OrdinalIgnoreCase ) )
241+ options . Add ( new ( root . GetRelativePath ( f ) , f . Quoted ( ) ) ) ;
242+ } ) ;
243+ return options ;
235244 }
245+ #endregion
236246
237247 #region EXTERNAL_EDITOR_FINDER
238248 private string FindVSCode ( )
@@ -385,35 +395,5 @@ private string FindZed()
385395 return string . Empty ;
386396 }
387397 #endregion
388-
389- private void OpenFolderAndSelectFile ( string folderPath )
390- {
391- var pidl = ILCreateFromPathW ( folderPath ) ;
392-
393- try
394- {
395- SHOpenFolderAndSelectItems ( pidl , 0 , 0 , 0 ) ;
396- }
397- finally
398- {
399- ILFree ( pidl ) ;
400- }
401- }
402-
403- private List < Models . ExternalTool . LaunchOption > GenerateVSProjectLaunchOptions ( string path )
404- {
405- var root = new DirectoryInfo ( path ) ;
406- if ( ! root . Exists )
407- return null ;
408-
409- var options = new List < Models . ExternalTool . LaunchOption > ( ) ;
410- root . WalkFiles ( f =>
411- {
412- if ( f . EndsWith ( ".sln" , StringComparison . OrdinalIgnoreCase ) ||
413- f . EndsWith ( ".slnx" , StringComparison . OrdinalIgnoreCase ) )
414- options . Add ( new ( root . GetRelativePath ( f ) , f . Quoted ( ) ) ) ;
415- } ) ;
416- return options ;
417- }
418398 }
419399}
0 commit comments