VOGONS

Common searches


CLI - DIR switches?

Topic actions

First post, by moejoe

User metadata
Rank Newbie
Rank
Newbie

Hi,
I have several apps (old qbasic programs) that use "DIR /B /AD /ON" to get the content of the current directory. however, DOSBox does not support additional DIR parameters. is there any hope those will be included in future versions? I'd really like to run those apps in DOSBox...

Last edited by moejoe on 2014-02-11, 21:55. Edited 4 times in total.

Reply 3 of 22, by moejoe

User metadata
Rank Newbie
Rank
Newbie

I just checked this again and even programmed my own version of DIR. However, even this doesn't work because DOSBox apparently interprets "DIR.exe" (when accessing it from the shell) as "DIR .exe", and is thus listing all exe files in the current directory. I wouldn't mind the lack of accepted parameters if at least I could use my own DIR.exe here. 🙁

Reply 6 of 22, by moejoe

User metadata
Rank Newbie
Rank
Newbie

Bump... It would be nice if DOSBox would at least scan for valid parameters, even if it doesn't apply them. So for example to make /ON work (which I used in various games back then), one would simply have to add

ScanCMDBool(args,"ON");

To shell_cmds.cpp in void DOS_Shell::CMD_DIR(char * args).

Reply 8 of 22, by moejoe

User metadata
Rank Newbie
Rank
Newbie
ripsaw8080 wrote:

Did you set the COMSPEC environment variable to point to the 4DOS program?

Of course not, I was not told that this would have to be done.
Anyway, this seems to be quite an overkill solution as opposed to adding a single line of code to the DOSBox code base, especially since I want to make my old games available to other people and not to myself - so everyone of them would have to get through all those hassles.

Reply 10 of 22, by moejoe

User metadata
Rank Newbie
Rank
Newbie
DosFreak wrote:

So either modify your games or modify DOSBox.

Those are games that were made aeons ago in a language I don't program in anymore, that doesn't even come with its own directory listing facilities (QBasic), so I will certainly not rewrite all of them.
And I have even given instructions on how to emulate the missing switches above, so why not simply incorporate them into the trunk?

Reply 12 of 22, by moejoe

User metadata
Rank Newbie
Rank
Newbie

I somehow must have stranded in the wrong forum, I guess. I can somehow understand if you don't want to support demos or other applications that are not games, but games? I am very sure that there are more games than just mine that make use of the /ON switch for the DIR command. It's one damn line you have to add and the games will even work with a standard dosbox installation, without having to resort to a DOSBox version compiled by someone completely else. Standard DOSBox is available for many systems I will never be able to compile programs for, so how is that "private build" supposed to work for other people who want to play those games?

nobody else cares about fake parameters.

Is that how you reply to all patch suggestions, yes? It's one single line of code, even if noone else might care (which I heavily doubt), how would it hurt having this in the trunk? I think you are just denying help here because you love showing power, not because you want to be helpful.

Reply 13 of 22, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

I am very sure that there are more games than just mine that make use of the /ON switch

Which one?
If it really uses that switch it would break because your suggestion is to *ignore* that switch.

Is that how you reply to all patch suggestions, yes?

I don't see a patch but some crude hack to make your app work.

Reply 14 of 22, by moejoe

User metadata
Rank Newbie
Rank
Newbie
wd wrote:

If it really uses that switch it would break because your suggestion is to *ignore* that switch.

No. At the moment, all DOSBox returns to the game is "Illegal Switch: /ON". This is written to a file (using something like "DIR /B /ON > foo.txt") and the game expects to find a list of file names in that file. So in that case it will find one invalid filename ("Illegal switch") in that file, which effectively breaks the game. If the files weren't sorted by name that would still be fine, but not getting any files at all is not.

Which one?

Dungeon 2 (by me) uses /ON in the setup code, so player can't play a custom map.

Paddle Battle (by me) uses /ON to retrieve a list of player graphics, so won't run at all in DOSBox.

Frankus Tracker II (not by me) uses /ON to retrieve a list of songs when loading/saving using the F2/F3 keys.

The point is, DIR emulation is incomplete in its current state and I bet there are even games and applications that make use of the other even less used but still valid switches as well. As most switches are not critical to the output (apart from /B and /AD, which luckily are already supported!), it would be much better to simply ignore them instead of printing an error. That way, some file listings might not be in the expected order, but that's still way better than having no file list at all. I suppose most applications wouldn't crash from a list that is not sorted by file name / date / extension, but as you can see above, there are cases where programs become unusable because there is no file list at all. And believe me, using DIR for getting a directory listing was usual in programming languages that didn't offer native / library commands for this task.

Reply 15 of 22, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

I suppose most applications wouldn't crash from a list that is not sorted

Yeah and to avoid the rest of them feel free to post a patch rather than a hack if you really want this to get any attention.

Reply 16 of 22, by moejoe

User metadata
Rank Newbie
Rank
Newbie

I didn't do a svn checkout so here's a full copy instead of a diff of my modified shell_cmds.cpp, with support for all /O switches (including reverse sorting).

Attachments

  • Filename
    shell_cmds.7z
    File size
    10.38 KiB
    Downloads
    239 downloads
    File license
    Fair use/fair dealing exception

Reply 18 of 22, by moejoe

User metadata
Rank Newbie
Rank
Newbie

Updated version of the patch, this time as a patch file, against current trunk, and with some small fixes (/OD wasn't sorting correctly, /A-D was missing).

Maybe this can be moved to the development/patch forum?

Attachments

  • Filename
    shell_cmds.cpp.patch
    File size
    3.96 KiB
    Downloads
    137 downloads
    File license
    Fair use/fair dealing exception

Reply 19 of 22, by LazerTag

User metadata
Rank Newbie
Rank
Newbie

Was this patch ever added to Dosbox or can the patch be obtained from somewhere? I apparently don't have rights currently to download it from this thread. Probably due to not having any posts yet or something. Anyway if this sorts out the 'Illegal switch: /on' I could really use it. Trying to get a pretty old application we use running in Dosbox under Linux so I can finally kill off a Windows XP box that only lives to serve this single purpose. 😒

EDIT: ahh, now that I have posted I can see the patch file download. Is this valid for Dosbox 0.74 source?

Last edited by LazerTag on 2016-09-09, 14:00. Edited 1 time in total.