OpenBVE
OpenBVE copied to clipboard
No support for global environmental variables to use as file paths?
Would be cool to be able to use environmental variables to refer to paths. I'm using a unique way to organize content files which currently is only limited to using dots and slashes to access parent folders from a relative path, but if those diverse paths are easily accessed using these types of variables the flexibility is immediately higher.
Have you considered the $Sub() command?
That at least allows re-using a complete path. Not convinced by allowing environment variables- there's no real need for this IMHO, and it makes the security messes even worse.
Another thing to note is that custom environment variables are only available on your PC.
Adding easy access to the train / object / sound folders might be worthwhile, but anything else I'd want a real good reason to add....
The $Sub() command works well & manages this for routes, but for trains no quick workaround methods like that are available (to my knowledge). While i am aware that custom variables only would affect my pc if added manually, setting them through a setup installer .exe that would be responsible for installing the needed files for the given package seemed to work as i was testing them beforehand using different machines. On the other hand, i guess there isn't a stricter reason to add them other than flexibility when managing those train files; the long paths needed to be written every general & specific instance (which in my case there are many different specific paths based on the respective use itself), working with quite a large amount of B3Ds for a mildly complex system of functions that drive a single component present in the train, etc. I can see it being useless on a more small-scale situation or for routes to an extent (considering the $Sub command), but for a bigger-scaled project makes it quite annoying and messy having to avoid mixing textures and object files in the same path & folder (reduces messes) , avoiding too long paths due to a deeper organization (as the system can produce an error if the path is too long), but also having to read and count how many parent directories are needed to go back to before accessing the intended file each time, & avoiding quite extensive States lines (or long paths in the [include] section) within the animated files used (allows for better readability as a developer).
Addons should not have access anywhere outside Content folder. That's a open way to malware.
Precisely. It's bad enough loading arbritray train plugins without adding another vector.
Having said that, possibly something like this at the start of a path might work:
$Train - Path is relative to the train folder
$Railway- Path is relative to the railway folder
$Object- Path is relative to the object folder
$Route- Path is relative to the route folder
$Sound- Path is relative to the sound folder
$Compatability- Path is relative to the compatability folder
https://github.com/leezer3/OpenBVE/issues/395