QB64 Phoenix Edition
under linux Program Console BUG - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: Chatting and Socializing (https://qb64phoenix.com/forum/forumdisplay.php?fid=11)
+--- Forum: General Discussion (https://qb64phoenix.com/forum/forumdisplay.php?fid=2)
+--- Thread: under linux Program Console BUG (/showthread.php?tid=495)

Pages: 1 2


under linux Program Console BUG - Coolman - 05-26-2022

i made a console program ($Console:Only) that should run in a terminal. it seems that when executing a console program, the current directory is the one of the executable. the _CWD$ function confirms it.


RE: _CWD$ under linux - bplus - 05-27-2022

Are you able to change directory? If so what does _CWD$ report then?


RE: _CWD$ under linux - Coolman - 05-27-2022

(05-27-2022, 12:51 AM)bplus Wrote: Are you able to change directory? If so what does _CWD$ report then?

hello, the program must run in a bash script. i put it in a directory listed in the path so that it is accessible. _CWD$ returns at runtime the executable directory instead of the current directory. using chdir to a directory, _CWD$ works. it's very annoying. it looks like a bug.

example :
Code: (Select All)
$Console:Only
Color 14
Print _CWD$
ChDir "..\"
Print _CWD$



RE: _CWD$ under linux BUG - Coolman - 05-29-2022

explanation. all console programs are supposed to be located in the current directory. this is not the case for programs generated by qb64. the _CWD$ function simply confirms this anomaly. well. while waiting for a possible correction, I rewrote the program in freebasic.


RE: _CWD$ under linux BUG - Kernelpanic - 05-29-2022

(05-29-2022, 10:34 AM)Coolman Wrote: explanation. all console programs are supposed to be located in the current directory. this is not the case for programs generated by qb64. 

Do you mean this:
With a new file, the program folder is always displayed, not the last directory from which a call was made.
This also applies to saving a new file. That is also in Version 2.02 so.

[Image: Startet-im-Programmordner-K.jpg]


RE: _CWD$ under linux BUG - Coolman - 05-29-2022

(05-29-2022, 03:22 PM)Kernelpanic Wrote:
(05-29-2022, 10:34 AM)Coolman Wrote: explanation. all console programs are supposed to be located in the current directory. this is not the case for programs generated by qb64. 

Do you mean this:
With a new file, the program folder is always displayed, not the last directory from which a call was made.
This also applies to saving a new file. That is also in Version 2.02 so.

[Image: Startet-im-Programmordner-K.jpg]

hello. i will give a simple example under linux. for example the command ls :

- go to a directory and run ls (bash command to list files and directories)

- the command works in the current directory.

with a qb64 console program, the current directory is the one of the executable. i don't know if it's clear. i use an online translator...


RE: under linux Program Console BUG - Kernelpanic - 05-29-2022

Quote:- go to a directory and run ls (bash command to list files and directories)

- the command works in the current directory.


The "ls -al" command works even if I specify a different directory; see screenshot.
I am in "~/lab/c" and let me show from there my home directory "~".

But I don't understand the last sentence. I can't really imagine what you mean.
(My comments are also half me, half translator.  Wink  )



[Image: ls-anderes-Verzeichnis2022-05-29.jpg]


RE: under linux Program Console BUG - DSMan195276 - 05-29-2022

That's correct behavior, _STARTDIR$ contains the original current directory and your can use CHDIR to switch back to it.


RE: under linux Program Console BUG - Coolman - 05-29-2022

*** That's correct behavior

not really. normally, all console programs point to the current directory automatically...

*** _STARTDIR$ contains the original current directory and your can use CHDIR to switch back to it.

thank you. yes, it solves the problem.


RE: under linux Program Console BUG - DSMan195276 - 05-29-2022

I agree with that, I meant correct behavior for a QB64 program. I don't know why it does that but it can't be changed at this point.