Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Use of _STARTDIR$
#1
The operation and logic of the command seem clear.
However, I would like to point out that at least in one case, the execution causes a problem.

Specifically, it concerns my case:

1) With a Windows launcher (there are many free ones), I start the QB64 IDE (I often use DavisIDE because it is more comfortable and less cumbersome);

2) It performs the compilation (the EXE file is produced in the same folder as the BAS files, and that folder also contains the entire series of folders that make up the application);

3) That said, it would seem that the EXE file correctly sees where it is launched from and behaves as it should.

But no! The path detected by _STARTDIR$ is that of the launcher! So, you have to manually open the folder and launch the executable directly from there.

It's not a serious problem... I created a BAT file that executes everything and runs the execution without this annoying setback.


Perhaps - I say perhaps, but I understand that nothing is easy - _STARTDIR$ should read what it needs to read by looking at itself and where it is located.

I'm just mentioning this for the record...

Thank you!
Reply
#2
Upon startup, QB64 programs implicitly execute a CHDIR to change to the directory containing the .exe file. This is so OPEN statements with paths relative to the .exe work as expected. You can show this location with the _CWD$ function.

_STARTDIR$ returns the current working directory before the implicit CHDIR at startup. This value is controlled by whatever executed the program, so your launcher is responsible for setting this value. In a standard Windows shortcut, this is controlled by the "Start in" parameter.

You probably don't want to use _STARTDIR$, it's for specific cases like command-line utilities that need to interpret user-supplied paths consistently no matter where the .exe is located.
Reply
#3
(08-22-2024, 11:55 AM)luke Wrote: Upon startup, QB64 programs implicitly execute a CHDIR to change to the directory containing the .exe file. This is so OPEN statements with paths relative to the .exe work as expected. You can show this location with the _CWD$ function.

_STARTDIR$ returns the current working directory before the implicit CHDIR at startup. This value is controlled by whatever executed the program, so your launcher is responsible for setting this value. In a standard Windows shortcut, this is controlled by the "Start in" parameter.

You probably don't want to use _STARTDIR$, it's for specific cases like command-line utilities that need to interpret user-supplied paths consistently no matter where the .exe is located.
Thank you, the difference wasn't entirely clear to me, but now you've made it evident.

On the other hand, the wikis in certain areas are minimal and also in a language that is not mine.
Reply




Users browsing this thread: 2 Guest(s)