Skip to content

Commit

Permalink
Select output file when revealing task output folder in explorer (#1049)
Browse files Browse the repository at this point in the history
  • Loading branch information
ScrubN authored May 7, 2024
1 parent 1b1c577 commit 1aff119
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions TwitchDownloaderWPF/PageQueue.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.ObjectModel;
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Threading;
using System.Windows;
Expand Down Expand Up @@ -313,7 +314,17 @@ private void MenuItemOpenTaskFolder_Click(object sender, RoutedEventArgs e)
return;
}

Process.Start(new ProcessStartInfo(outputFolder) { UseShellExecute = true });
var args = File.Exists(task.OutputFile)
? $"/select,\"{task.OutputFile}\""
: $"\"{outputFolder}\"";

Process.Start(new ProcessStartInfo
{
FileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "explorer.exe"),
Arguments = args,
UseShellExecute = true,
WorkingDirectory = outputFolder
});
}
}
}

0 comments on commit 1aff119

Please sign in to comment.