Closed ohlidalp closed 1 year ago
Works fine, tested both Windows and Linux. The demo script assumes you're on Windows though:
https://github.com/RigsOfRods/rigs-of-rods/pull/3060/commits/232f652e0ebb1b04313426f9ba3701d22c4fa54e#diff-eda76373262158e93d51c98a1022f3e36457074c022ce73e772f6373fe01434bR636
Should display the sys_cache_dir
CVar instead.
@CuriousMike56 Why didn't I think of that? Great point, thanks.
Minimum work (~ 2.5hrs) and unlimited possibilities. The user can now create, read, detect and delete text files in existing resource locations like "Cache" for the cache folder and "Scripts" for the scripts folder. Access to random files via absolute paths is not possible (game will report "access denied"). To see it in action, open ingame console and say![image](https://github.com/RigsOfRods/rigs-of-rods/assets/491088/81df214b-1621-4c32-8cc7-26affbbf9b20)
loadscript demo_script.as
- it showcases the new feature. To test security, sayas game.createTextResourceFromString("boo", "C:\boo.txt", "Cache")
in the console and see what happens.Here is a reprint of the documentation:
My vision is to use this for a script editor with examples, with the option to save files to Documents\My Games\Rigs of Rods\scripts and run them with a click of a button. This branch only delivers the script functions though.