I am working on a mod script in Python for a legacy game. This game looks for the folder “AI” in its installation directory. Now, everytime before the game runs, a certain folder is chosen (say, AI_1 or AI_2), which should behave as if it is the AI folder (the actual AI folder doesn’t exist).
I thought of a few solutions:
- Temporary rename AI_1 to AI, run the game and rename back.
- Create a symbolic pointing to AI_1 with the name AI.
Now both options are not looking optimal to me, because 1 is “dirty”, and if the script exits unexpectedly it leaves behind trash, and 2 is hard to do on Windows. I have looked at NTFS junctions, but some users of this game run it from a FAT usb-stick and I don’t want to leave them in the cold.
What is the best way to do this?
I think that option with renaming is fine. To workaround a situation when scrip is terminated unexpectedly put an additional file with original folder name to all of the AI_x folders. Then on startup just check this file in AI folder and rename the folder back to its original name.
Another variant is to add only one file to the game folder where an original name of the folder that is currently renamed to AI will be stored.