CHDIR reports failure when it succeeds
A Logo programming environment for Microsoft Windows
Brought to you by:
david_costanzo
I used to be able to type
chdir ".
and get the current/working directory printed in the Command Center. Similar to the pwd linux command.
Now, using Spanish version 8.0.2+ I get:
No pude cambiar a directorio "."
Is there another way to get the current/working directory.
Even though you're not using CHDIR for its expected side-effect, I would expect that to work. It's not working for me either (on GNU/Linux). I'll have to look into this. It may be a regression.
As for another way to get the current working directory, I answered that a few years ago here. The answer should still work in FMSLogo 8.0.0 although it's now possible to call the Unicode version of GetCurrentDirectory.
Related
Discussion: pwd
Ticket moved from /p/fmslogo/support-requests/22/
I've changed this to a bug. CHDIR reports failure when it succeeds but since it was designed to print an error to the commander instead of throw an error, none of the tests could detect the bug. (There's a bug in wxWidgets that blocks the automated regression tests from reading what it written to the commander's history).
The bug is obvious by inspection code. wxSetWorkingDirectory returns true on success.
I still have to figure out when it was introduced and (of course) fix it. I expect that this will force the release of FMSLogo 8.1.0.
The bug was introduced in [r4954], first released in FMSLogo 8.0.0. It was introduced when I switched FMSLogo from using
char *towchar_t *for its internal strings (the main change to support Unicode). The code had previously used chdir, mkdir, and rmdir which acceptchar *, notwchar_t *. All of these function return 0 on success. I changed these to use the wxSetWorkingDirectory, wxMkDir, and wxRmDir from wxWidgets. All of these functions return 0 (false) on failure. As mentioned above, my tests didn't catch this because CHDIR does correctly change directories and my tests cannot read what it prints to the commander history.I have committed a fix for this as [r5714]. It will be available in FMSLogo 8.1.0.
If you want to use CHDIR print the current directory in FMSLogo 8.0.X, you can ask it to change to an impossible directory, like:
Changing to that directory will fail, but it will report success with the current working directory.
Related
Commit: [r4954]
Commit: [r5714]
Thanks David.