Skip to content

Commit

Permalink
Look for FFmpeg in both user-wide and system-wide PATH locations (#495
Browse files Browse the repository at this point in the history
)
  • Loading branch information
zandiarash authored Sep 18, 2024
1 parent 98e5c27 commit 58718ef
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions YoutubeDownloader.Core/Downloading/FFmpeg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,17 @@ static IEnumerable<string> GetProbeDirectoryPaths()
yield return AppContext.BaseDirectory;
yield return Directory.GetCurrentDirectory();

if (Environment.GetEnvironmentVariable("PATH")?.Split(Path.PathSeparator) is { } paths)
// User PATH environment variable
if (Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.User)?.Split(Path.PathSeparator) is { } userPaths)
{
foreach (var path in paths)
foreach (var path in userPaths)
yield return path;
}

// System PATH environment variable
if (Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Machine)?.Split(Path.PathSeparator) is { } systemPaths)
{
foreach (var path in systemPaths)
yield return path;
}
}
Expand Down

0 comments on commit 58718ef

Please sign in to comment.