@@ -123,8 +123,8 @@ internal static Result CreateFolderResult(string title, string subtitle, string
123
123
}
124
124
else
125
125
{
126
- // or make this folder the current query
127
- Context . API . ChangeQuery ( GetPathWithActionKeyword ( path , ResultType . Folder , query . ActionKeyword ) ) ;
126
+ // or make this folder the current query
127
+ Context . API . ChangeQuery ( GetPathWithActionKeyword ( path , ResultType . Folder , query . ActionKeyword ) ) ;
128
128
}
129
129
130
130
return false ;
@@ -255,15 +255,15 @@ internal static Result CreateFileResult(string filePath, Query query, int score
255
255
{
256
256
if ( c . SpecialKeyState . ToModifierKeys ( ) == ( ModifierKeys . Control | ModifierKeys . Shift ) )
257
257
{
258
- OpenFileAsAdmin ( filePath ) ;
258
+ OpenFile ( filePath , Settings . UseLocationAsWorkingDir ? Path . GetDirectoryName ( filePath ) : string . Empty , true ) ;
259
259
}
260
260
else if ( c . SpecialKeyState . ToModifierKeys ( ) == ModifierKeys . Control )
261
261
{
262
262
OpenFolder ( filePath , filePath ) ;
263
263
}
264
264
else
265
265
{
266
- OpenFile ( filePath ) ;
266
+ OpenFile ( filePath , Settings . UseLocationAsWorkingDir ? Path . GetDirectoryName ( filePath ) : string . Empty ) ;
267
267
}
268
268
}
269
269
catch ( Exception ex )
@@ -287,10 +287,10 @@ private static bool IsMedia(string extension)
287
287
return MediaExtensions . Contains ( extension . ToLowerInvariant ( ) ) ;
288
288
}
289
289
290
- private static void OpenFile ( string filePath )
290
+ private static void OpenFile ( string filePath , string workingDir = "" , bool asAdmin = false )
291
291
{
292
292
IncrementEverythingRunCounterIfNeeded ( filePath ) ;
293
- FilesFolders . OpenPath ( filePath ) ;
293
+ FilesFolders . OpenFile ( filePath , workingDir , asAdmin ) ;
294
294
}
295
295
296
296
private static void OpenFolder ( string folderPath , string fileNameOrFilePath = null )
@@ -299,28 +299,6 @@ private static void OpenFolder(string folderPath, string fileNameOrFilePath = nu
299
299
Context . API . OpenDirectory ( folderPath , fileNameOrFilePath ) ;
300
300
}
301
301
302
- private static void OpenFileAsAdmin ( string filePath )
303
- {
304
- _ = Task . Run ( ( ) =>
305
- {
306
- try
307
- {
308
- IncrementEverythingRunCounterIfNeeded ( filePath ) ;
309
- Process . Start ( new ProcessStartInfo
310
- {
311
- FileName = filePath ,
312
- UseShellExecute = true ,
313
- WorkingDirectory = Settings . UseLocationAsWorkingDir ? Path . GetDirectoryName ( filePath ) : string . Empty ,
314
- Verb = "runas" ,
315
- } ) ;
316
- }
317
- catch ( Exception e )
318
- {
319
- MessageBox . Show ( e . Message , "Could not start " + filePath ) ;
320
- }
321
- } ) ;
322
- }
323
-
324
302
private static void IncrementEverythingRunCounterIfNeeded ( string fileOrFolder )
325
303
{
326
304
if ( Settings . EverythingEnabled )
0 commit comments