12-05-2022, 03:48 AM
I wouldn't recommend relying on `Command$(0)`, it's unreliable for this as it may have a relative path such as `./foobar/qb64pe.exe`. Stripping off the exe in that case will give you the path "./foobar", which will be treated relative to your current CWD and likely give you the wrong result since it's not absolute.
The best way to handle this would be saving the contents of `_CWD$` as soon as the program starts, since we always fill that with the location of the executable (discovered by OS-specific means other than `Command$(0)`).
If you're finding that `_CWD$` is unreliable for some reason at the start of the program then that sounds like a bug, but it really shouldn't be as it's fairly straight forward in what it does. I'd be curious to hear what behavior you're seeing where it's wrong.
The best way to handle this would be saving the contents of `_CWD$` as soon as the program starts, since we always fill that with the location of the executable (discovered by OS-specific means other than `Command$(0)`).
If you're finding that `_CWD$` is unreliable for some reason at the start of the program then that sounds like a bug, but it really shouldn't be as it's fairly straight forward in what it does. I'd be curious to hear what behavior you're seeing where it's wrong.