Reply 20 of 26, by Rekrul
wrote:- when I wrote the part of OS independence I assumed using Dosbox like Dos where you typically had one drive C:/ where everything got installed to. So "mount c somepath" is all one needs to adjust in the default config. Then have the batch files in somepath/batch and add c:/batch to the PATH environment via main config.
Have all cd-rom images in somepath/images and when you need to imgmount for a game use "imgmount d c:/images/game.iso" in the game.bat.
There are two different factors at work here; The emulated file system and the real host file system.
All of the DOS programs and commands running in DOSBox only know about the emulated file system, and are completely oblivious to the real file system. In other words, if you give the command "mount c C:\DOSGames" and then type the command "dir c:" it will show you the contents of "DOSGames" rather than your real C: drive.
However, the mount and imgmount commands only know about the real file system and are completely oblivious to the emulated one. For example, let's say that you give the command "mount c C:\DOSGames". Then you create a sub-directory in there called "Stuff" so that you have "C:\DOSGames\Stuff". If you were to then type "dir C:\Stuff" in DOSBox, it would show you the contents of the "Stuff" sub-directory. However, if you were to give the command "mount e C:\Stuff", it would not mount that sub-directory as the E: drive. It would look on your ACTUAL C: drive for a directory called "Stuff".
Therein lies the problem. In order to be portable, the batch files can only contain relative paths. In other words, "mount c DOSGames" is portable between different OSs, but "mount c C:\DOSGames" is not, because other OSs don't use letters to designate the drive. So the batch files can only reference sub-directories which are accessible from the current directory. However, the current directory for the mount & imgmount commands can't be set from within DOS, because that's an element of the real file system.
Unless you have some way to designate the directory with all your games as the working directory, all the relative path assignments in the mounts commands will fail.
The problem is compounded if you have the CD images stored elsewhere. For example, let's say that you have;
C:\DOSGames
C:\Images
All of your games are installed in "DOSGames" but all your ISO files are in "Images". If you set the working directory to "DOSGames", there's no way that you can then reference the "Images" directory using only a relative path. You would need to use an absolute path, and then the batch file is no longer portable.
In a normal Windows installation of DOSBox 0.74, the working directory defaults to "C:\Program Files\DOSBox 0.74". Unless you change it, any relative path in the mount commands will be looked for in the DOSBox directory.
This is why I favor putting all the game's files, including the ISO file, into a sub-directory and then calling DOSBox with a Windows BAT file. When the BAT file runs, the working directory is automatically set to whatever directory the BAT file was in. All relative paths then work. It may not be OS portable, but it makes that entire directory portable. I imagine that with slight editing of the BAT file, it would work on other OSs as well.
Don't the Mac and Linux have their own scripting language where you can issue commands like "DOSBox -conf game.conf"?