Skip to content

Commit

Permalink
Do a better job finding the default VLC
Browse files Browse the repository at this point in the history
  • Loading branch information
asherber committed Oct 28, 2018
1 parent fd69682 commit 97bcbfa
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
18 changes: 17 additions & 1 deletion src/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public partial class MainForm : Form
public MainForm()
{
InitializeComponent();
SetDefaultVlcPath();
VlcLabel.Text = _defaultVlcCmd;
}

Expand Down Expand Up @@ -73,8 +74,23 @@ public MainForm()
};

private static readonly string _vlcArgs = String.Join(" ", _argList);
private static readonly string _defaultVlcCmd = @"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe";

private string _defaultVlcCmd;

private void SetDefaultVlcPath()
{
void TrySetDefaultPath(string path)
{
if (_defaultVlcCmd == null && File.Exists(path))
_defaultVlcCmd = path;
}

TrySetDefaultPath(@"C:\Program Files\VideoLAN\VLC\vlc.exe");
TrySetDefaultPath(@"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe");

var driveRoot = Path.GetPathRoot(Application.ExecutablePath);
TrySetDefaultPath(Path.Combine(driveRoot, @"\PortableApps\VLCPortable\App\vlc\vlc.exe"));
}

private void LaunchVlc(string videoFile)
{
Expand Down
2 changes: 1 addition & 1 deletion src/version.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"version": "1.1"
"version": "1.2"
}

0 comments on commit 97bcbfa

Please sign in to comment.