Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
_OpenFile Dialog in same folder as exe
#11
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.
Reply


Messages In This Thread
_OpenFile Dialog in same folder as exe - by bplus - 12-04-2022, 08:28 PM
RE: _OpenFile Dialog in same folder as exe - by DSMan195276 - 12-05-2022, 03:48 AM



Users browsing this thread: 27 Guest(s)