fix: seed VSSCRIPT_PATH from Windows registry#1244
Open
frankie1024 wants to merge 2 commits into
Open
Conversation
On Windows, Av1an currently depends on either VSSCRIPT_PATH or the vapoursynth CLI being discoverable before VSScript can be loaded. Standard installations already record the VSScript DLL path in the VapourSynth registry key, so read that value at startup and use it as a fallback when the environment variable is missing or empty.
FreezyLemon
reviewed
May 22, 2026
Contributor
|
Looks sensible, but I wonder if this shouldn't be done in the vapoursynth crate... |
Author
|
Thanks for the review. This PR is mainly to address the Windows case where VapourSynth is installed but VSSCRIPT_PATH is not set, which causes Av1an to fail finding VSScript. The current change adds a fallback in Av1an so users can run without manually exporting the env var. I’ll add a short safety comment for the unsafe block. Re the design question: I agree it may be cleaner for this to live in the vapoursynth crate long-term. I kept it in Av1an here as the smallest fix for the immediate user-facing issue, but I’m happy to move it upstream if that’s preferred. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On Windows, Av1an currently relies on one of these being true before VSScript can be loaded:
VSSCRIPT_PATHis already setvapoursynth.exeis available onPATHThat misses a common installation state where VapourSynth is installed correctly, the
VSScriptDLLregistry value exists, but neither of the two discovery paths above is available to Av1an yet. In that case startup can fail withVSScript API not available.This change adds a Windows-only fallback at process startup:
VSSCRIPT_PATHis missing or empty, readVSScriptDLLfromHKCU\\SOFTWARE\\VapourSynthandHKLM\\SOFTWARE\\VapourSynthVSSCRIPT_PATHbefore Av1an touches the VapourSynth bindingsWhy here
The existing
vapoursynthRust crate already honorsVSSCRIPT_PATH; the missing piece is that Av1an does not currently populate it from the standard Windows VapourSynth installation metadata.Verification
Locally verified on Windows by:
VSSCRIPT_PATHfrom the process environmentPATHav1an --versionBefore this patch, startup panicked with
VSScript API not available.After this patch, Av1an starts normally and detects VapourSynth through the registry-backed fallback.
I also ran
cargo build -p av1ansuccessfully.Note:
cargo test -p av1anstill has pre-existing Windowsvpypath escaping failures onmaster(for exampleencode_test_vpy_input), and this patch does not touch that area.