My recommendation: first, your main program should take its own file name as an argument, which represents where the data for the program lives, for example,
C:\program files\mycompany\mygame
This is responsible for deciding what data to use in any other program (for example, a bash script or driver or something else).
Secondly, define the subcomponents of the directory space with the data in unix format so that all the literals in the file name in your program have this format. No ifs and buts, always Unix. For instance:
spriteLib.loadSprite("data/sprites/sprite-ghost.bmp");
Now write a function that combines the one passed in the directory name (in native format) with the unix file name translated into the native format to get a suitable file name for access. You have already tried to do this, but use an OS-dependent function. Not. Write it yourself. Do you want to get this:
C:\program files\mycompany\mygame\data\sprites\sprite-ghost.bmp
Method @ Industrial-antidepressant (previously blonde blonde stupid blonde) is also not bad, but it is a little more work.
source share