Object path relative to what?
nico87 opened this issue · 3 comments
I've got a very simple question related to https://github.com/skiselkov/librain#define-windowwindshield-objects
Is the path relative to the aircraft folder? Or to the X-Plane main folder?
Thanks
File paths that the library uses aren't pre-processed in any way. That means:
- relative paths are relative to the current working directory of the process
- absolute paths work as you would expect
Most typically the CWD is the X-Plane root installation folder. However, it's prudent not to rely on that. You can ask X-Plane to tell you where your plugin's file is located on the filesystem as an absolute path using https://developer.x-plane.com/sdk/XPLMGetPluginInfo/ and https://developer.x-plane.com/sdk/XPLMGetMyID/
Alternatively, use https://developer.x-plane.com/sdk/XPLMGetNthAircraftModel/ to find the aircraft's ACF file and strip the last component to get an absolute path to your aircraft's root installation folder.
Thanks. This is what I imagined but wanted to be sure that you didn't code the library differently.
I like to keep things simple :)