VOGONS

Common searches


First post, by Alexander

User metadata
Rank Oldbie
Rank
Oldbie

Next problem a user has reported to me:

DOSBox and Windows seem to use different ways for making short file names. (Ok, in my opinion it's much better to use short names for the directories used inside a DOSBox drive but anyway.)

The user who has reported the issue to me uses the two folders "Prince of Persia" and "Prince of Persia 2". He has created the "Prince of Persia 2" folder first and than the "Prince of Persia" folder. So Windows uses this translation:

"Prince of Persia 2" -> PRINCE~1
"Prince of Persia" -> PRINCE~2

(To see the short name you can type "dir /x" on the Windows command line.) But DOSBox is ignoring this and adding the ~1, ~2, etc. in alphabetical order:

"Prince of Persia" -> PRINCE~1
"Prince of Persia 2" -> PRINCE~2

If the root folder of "Prince of Persia ?" is mounted as a drive a frontend (or even the user if he isn't using any help) needs to "cd" to the right PRINCE~? folder. For doing this I would need to reimplement to DOSBox translation logic. Wouldn't it be much easier to use the Windows API function

DWORD GetShortPathName(
LPCTSTR lpszLongPath,
LPTSTR lpszShortPath,
DWORD cchBuffer
);

for getting the short names ? The only thing against this I could imagine could be this would require some conditional compilation for different plattforms. But the benefit would me much less user confusion by having two different ways of making short directory names. - Just a suggestion.

(Oh, of course also tested on DOSBox 0.72 and the current CVS build from cvscompile.aep-emu.de.)

Reply 1 of 4, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

we are aware of that. Think the dosbox ones are always the windows ones in a different order. It wouldn't be easier to use the windows api function as then dosbox has different behaviour on different oses.
I recall that D-Fend had a special translation function in order to get the same results as dosbox (e.g. process them alphabetical instead of time wise order)

Water flows down the stream
How to ask questions the smart way!

Reply 2 of 4, by h-a-l-9000

User metadata
Rank DOSBox Author
Rank
DOSBox Author

#ifdef win32
GetShortPathName( ... )
#else
[use own generator]
#endif

The short filename is stored on disk at file creation time on Microsoft OSes so it can't be autogenerated properly. Of course if you want to use long filenames from different operating systems with the same batch files having identical names is an advantage.

1+1=10

Reply 3 of 4, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

#if hasx86
just use native processor
#else
core=normal
#endif

Sometimes it's not that easy, really 😉
Think at that place you don't have a fully-qualified path, so you can't use that function.

Reply 4 of 4, by Alexander

User metadata
Rank Oldbie
Rank
Oldbie

Yes, the GetShortPathName Windows API function only works on fully-qualified and existing path names (because as already mentioned) the short names are not generated but stored at file/folder creation.

Ok, I have written a "Windows short name to DOSBox short name" function today. (I do not have any of the classic D-Fend source codes, so I really needed to rewrite it.) Now D-Fend Reloaded will write the right cd commands to the autoexec section in all circumstances (at least I hope so).

And BTW I think the "same batch file on different plattforms" argument is quite good for the DOSBox way of creating short names.