First post, by DaveDDS
- Rank
- Member
-- For some reason I can't post in "DosBox Patches" --
Thought I'd pass this on - I've modified the DosBox I use (which happens to be
MB6 - but wasn't fixed in -X or STAGINE either when I looked -it's been a while
so it could be by now).
DosBox will auto complete a filename on the command line by pressing TAB - but
it has a serious bug! It works properly if name is preceeded by spaces or '\'
(in this case it does complete from the preceding directory name and leaves it
on the command line so you get the full filename).
The problem occurs if you are accessing files from the current directory on
another drive - with the <drive>: preceding the name. DosBox does correctly
complete from the current directory on the selected drive, but it REMOVES the
<drive>: prefix. The resulting name is that of a file on the other drive, but
entered like any other local file.
This caused me to lose data quite a few times, because of another bug in DosBox
COPY command which seems to open the destination before the source, or otherwise
not detect that it's trying to write to an open file.
eg: MYPRG.C exists in C:\SRC, testing changes on a copy
C:\SRC> copy MY<tab> R: (my RAMdrive)
>Becomes "copy MYPRG.C R:
C:> R:
R:> compile/run MYPROG - looks go, want to keep changes
R:> C:
C:\SRC>copy R:MY<tab>
>Becomes "copy MYPRG.C" - and IF YOU DON'T NOTICE and PRESS ENTER
>makes C:\SRC\MYPRG.C an empty file!
DosBox is a huge amount of source, and I've not taken the time to figure out
a lot of it, but finding where it processes '\t' was fairly easy, and I fixed
this particular flaw by adding a single line!
At about line 212 in: dosbox\src\shell_misc.cpp
--- Existing Lines ---
case'\t':
{
if (l_completion.size()) {
it_completion ++;
if (it_completion == l_completion.end()) it_completion = l_completion.begin();
} else {
// build new completion list
// Lines starting with CD will only get directories in the list
bool dir_only = (strncasecmp(line,"CD ",3)==0);
// get completion mask
char *p_completion_start = strrchr(line, ' ');
if (p_completion_start) {
p_completion_start ++;
completion_index = (Bit16u)(str_len - strlen(p_completion_start));
} else {
p_completion_start = line;
completion_index = 0;
}
char *path;
if ((path = strrchr(line+completion_index,'\\'))) completion_index = (Bit16u)(path-line+1);
if ((path = strrchr(line+completion_index,'/'))) completion_index = (Bit16u)(path-line+1);
--- Add this one here ---
if ((path = strrchr(line+completion_index,':'))) completion_index = (Bit16u)(path-line+1);
--- END --
Sorry - Message formatting messes up the tabs/spacing - but it should be easy
to find that section and it's only one line to add...
Dave Dunfield - https://dunfield.themindfactory.com