libobs: Resolve bin_path and data_path to absolute paths for modules - #13687
Open
notr1ch wants to merge 1 commit into
Open
libobs: Resolve bin_path and data_path to absolute paths for modules#13687notr1ch wants to merge 1 commit into
notr1ch wants to merge 1 commit into
Conversation
Many modules create paths based on obs_module_config_path and similar functions, which return a relative path based on the current directory. This causes a problem on Windows in combination with obsproject#11569. The path to the game capture hook DLL is sometimes passed as a relative path when the global hook can't be updated after an OBS update if it's in use. After calling SetDefaultDLLDirectories, the current directory is no longer searched, so the relative path to the hook DLL can't load and we get an inject -4 error. After this change, inject-helper is launched with both an absolute binary path and absolute argument, so nothing relies on the current directory any more. This commit extends beyond just win-capture though, as any module that was relying on the current directory will now be given absolute paths, which is more reliable in case any random DLL decides to change the CWD. An unfortunate "fixup_path" call is needed on Windows, as we have historically only ever used module paths with / as a path separator, and libobs itself also assumes this, so for compatibility we convert Windows \ directory separators back to /.
notr1ch
force-pushed
the
r1ch/absolute-mod-paths
branch
from
July 23, 2026 00:00
49d07e6 to
4203dcd
Compare
7 tasks
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.
Description
Many modules create paths based on
obs_module_config_pathand similar functions, which return a relative path based on the current directory.This causes a problem on Windows in combination with #11569. The path to the game capture hook DLL is sometimes passed as a relative path when the global hook can't be updated after an OBS update if it's in use. After calling
SetDefaultDLLDirectories, the current directory is no longer searched, so the relative path to the hook DLL can't load and we get an inject -4 error.After this change, inject-helper is launched with both an absolute binary path and absolute argument, so nothing relies on the current directory any more. This commit extends beyond just win-capture though, as any module that was relying on the current directory will now be given absolute paths, which is more reliable in case any random DLL decides to change the CWD.
An unfortunate
fixup_pathcall is needed on Windows, as we have historically only ever used module paths with / as a path separator, and libobs itself also assumes this, so for compatibility we convert Windows \ directory separators back to /.Motivation and Context
Fix reported inject -4 errors.
How Has This Been Tested?
Forced OBS to inject with local hook DLL and verified full path to inject helper and its arguments were used.
Types of changes
Checklist: