Conversation
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.
TL;DR: modloader can translate absolute paths coming from narrow (
A) Win32 functions, but not the same path when it arrives through a wide (W) function.CLEO's
stream_custom_scriptusesstd::filesystem/std::ifstream, which call the wide functions(
GetFileAttributesExW,CreateFileW). If the path to the script is absolute, modloader can't match it with the file that exist only inside the mod directory. While it can be argued as intended behavior (after all, it is absolute path to a file which does not exist at said location), to user's surprisedoes_file_existworks fine, because it uses narrow GetFileAttributesA API.Repro
modloader_abs_repro.zip
Drop the folder into
<SA>\modloader\, put your game folder inabs_path.ini, run the game, then read<game>\abs_repro.txt. Tested with both CLEO 4.4.4 and CLEO 5.4.0 and ModLoader 0.3.11:std.asi.dllabs_repro.txtabs: exists=1 load=1 [^1] cleo: exists=1 load=0← bug (load from (absolute)cleo:fails)abs: exists=1 load=1 cleo: exists=1 load=1abs: exists=1 load=0← bug (load from absolute path fails)abs: exists=1 load=1^1 note that absolute paths used in scripts work in CLEO 5 because of CLEO's own modloader compatibility fix. But this fix is not applied to virtual paths like
cleo:\script.csand also not available in CLEO 4.4.4.Why it happens
C:\GTA San Andreas\cleo\script.cs.AR_PATH_INE).GetCurrentDir((const char*) arg, …).nullptr,bCheckModulesstaysfalse, and no mod folder is ever probed.For a relative path the other branch runs (
GetCurrentDir(buffer, MAX_PATH)= the process CWD,narrow) and the probe works.
cleo\script.csloads fine.The Fix
Convert the game path to the same type as the argument for comparison to work.