

This is why initially chdir only accepted 0 and 1 to choose between the two directories. Ultimately the goal was to get access to the User Files directory, as in normal case the script should only operate within the game directory using relative paths. I think adding chdir command in user scripts was a mistake as it mutates the global state and lead to subtle bugs and race conditions. That fix should go in the direction of not using chdir to read files in User Files from another thread.įYI I've sent you a CLEO.asi patched with the second fix. Considering CAEStreamThread behavior is so subtle and non-deterministic, probably breaking so many other mods with their authors not even noticing, a fix on that should probably be good. Thus I ask you if you could please give context on the introduction of this feature in 4.3. Chdir is prone to race conditions, using it in any form should be avoided, not encouraged. Remove the script local chdir feature.Would be nice if we could disable it somehow after the script does something specific, but I can't visualize what that is at the moment. In this case, script local chdir feature gets enabled.

Save a boolean indicating this script has used SET_CURRENT_DIRECTORY.Cc see the following solutions (in no particular preference order at the moment of writing):
