Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Look for FFmpeg in both user-wide and system-wide PATH locations #495

Merged
merged 2 commits into from
Sep 18, 2024

Conversation

zandiarash
Copy link
Contributor

Environment.GetEnvironmentVariable("PATH") gives you the effective PATH that the operating system uses when searching for executable files from User PATH.
Thus if some developers like me add FFMPEG path to system PATH they always face with that page which tells there is no FFMPEG installed or cannot be found.
I had changed codes to get the PATH from both the System and User environment variables.

@Tyrrrz Tyrrrz added the bug Something isn't working label Aug 31, 2024
Comment on lines 20 to 23
var UserAndMachineEnvironmentVariables =
$"{Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.User)}{Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Machine)}";

if (UserAndMachineEnvironmentVariables?.Split(Path.PathSeparator) is { } paths)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please just do two if's/foreach's, it's easier to read this way

Copy link
Contributor Author

@zandiarash zandiarash Sep 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please just do two if's/foreach's, it's easier to read this way

Now I did it with two if's/foreach's as you desired.
Please check the next commit.

@Tyrrrz Tyrrrz changed the title Both User and Machine EnvironmentVariables Look for FFmpeg in both user-wide and system-wide PATH locations Aug 31, 2024
@Tyrrrz Tyrrrz added enhancement New feature or request and removed bug Something isn't working labels Sep 18, 2024
@Tyrrrz Tyrrrz merged commit 58718ef into Tyrrrz:master Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants