VOGONS

Common searches


First post, by vitcunha

User metadata
Rank Newbie
Rank
Newbie

Sorry if this is the wrong place to post this. Please move at will.
I am running DOSBox 0.74 in OSX 10.8.5

K, do I have a folder called "A" and it has a messy path.
Inside A we have 4 files:

  • A.exe
    DOSBox.app
    config.conf
    A.command

I want to make a portable DOSBox able to run A.exe with a double click.
The thing is, i'll have lots of folders (e.g. "B"), and inside each of them I'll have 4 files.
The difference will be the config.conf: each with an autorun setup to properly run the respective .exe
(And the .exe, of course)

What I did was:
Since Dosbox is being opened in the same folder as what I want to run, I made a .command with the following line:

open $(dirname "$0")/DOSBox.app --args -conf $(dirname "$0")/config.conf

It's the same code suggested in http://www.dosbox.com/wiki/DOSBox_and_Mac_OS_X but I changed the absolute paths with this "dirname" thing.
I then opened Terminal, went to the A folder and hit

chmod +x A.command

I double clicked A.command and it works: I have no dropbox app elsewhere yet and it runs this one with its config file. If I move either of them, it stops, so they are rooted correctly.

What's happening:
I then add to the config.conf file in the autorun section the following:

mount C .
C:
A.exe

It hits

"Illegal Command A.exe"

If only I could run that I would have my program running in a double click.

So I tried to remove the A.exe from the autorun code and type

dir

And I noticed it reports as if the DOSBox app was in my

~/

folder (which is the "Home") (!!!)
I tried running the Dosbox app directly (which then doesn't load with the .conf I want). I

mount C .

again, hit "dir" and it shows correctly in the "A" folder content.

Any thoughts?
Thanks in advance
V

Reply 1 of 5, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

mount uses the current working directory as base.

next version has a flag to make it relative to the loaded configuration file.

But at some level you are bound to use the working directory, if you specify only relative paths (as you are doing)

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

Reply 2 of 5, by vitcunha

User metadata
Rank Newbie
Rank
Newbie

Thank you so much for your reply.
I may flag I am not a programmer, all I did was to google what appeared to be my necessity.

Qbix wrote:

But at some level you are bound to use the working directory, if you specify only relative paths (as you are doing)

I'm not sure I understand your answer.
Shouldn't it recognise the working directory (mounting with the "period") as the App's Folder for I am running the App in that very folder?
Thank you very much in advance.

Reply 3 of 5, by Jorpho

User metadata
Rank l33t++
Rank
l33t++
vitcunha wrote:

Shouldn't it recognise the working directory (mounting with the "period") as the App's Folder for I am running the App in that very folder?

Well, that's not happening.

If you want to mount the current directory (or do anything else with any environment variables), you will have to start DOSBox with the "-c" switch.

You might be able to use

open $(dirname "$0")/DOSBox.app --args -c "mount c $(dirname ""$0"")" -conf $(dirname "$0")/config.conf

but I'm not sure how you would deal with the nested double quotes.

Reply 4 of 5, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author
vitcunha wrote:
Thank you so much for your reply. I may flag I am not a programmer, all I did was to google what appeared to be my necessity. […]
Show full quote

Thank you so much for your reply.
I may flag I am not a programmer, all I did was to google what appeared to be my necessity.

Qbix wrote:

But at some level you are bound to use the working directory, if you specify only relative paths (as you are doing)

I'm not sure I understand your answer.
Shouldn't it recognise the working directory (mounting with the "period") as the App's Folder for I am running the App in that very folder?
Thank you very much in advance.

Well. DOSBox doesn't know a thing about the working directory. It gets passed that from your OS. So maybe check if Apple behaves like you think it should.

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

Reply 5 of 5, by vitcunha

User metadata
Rank Newbie
Rank
Newbie
Jorpho wrote:
If you want to mount the current directory (or do anything else with any environment variables), you will have to start DOSBox w […]
Show full quote

If you want to mount the current directory (or do anything else with any environment variables), you will have to start DOSBox with the "-c" switch.

You might be able to use

open $(dirname "$0")/DOSBox.app --args -c "mount c $(dirname ""$0"")" -conf $(dirname "$0")/config.conf

but I'm not sure how you would deal with the nested double quotes.

IT WORKED!! I am so grateful! Thank you very much!
I didn't know about the -c command.

The only that happened was, when loading the config file, the things written inside the config were typed inside Dosbox before the "-c" command lines inside the ".command" file.... I don't quite know why.
So i cleaned my autorun lines (which do not support dirname commands) and wrote them inside the .command file instead.
So the final code is like this:

open $(dirname "$0")/DOSBox.app --args -c "mount c $(dirname ""$0"")" -c C: -c A.exe -conf $(dirname "$0")/config.conf

Working like a charm: A.exe opened in a double click.
Thank you once again.

Qbix wrote:

Well. DOSBox doesn't know a thing about the working directory. It gets passed that from your OS. So maybe check if Apple behaves like you think it should.

Thank you for your answer and help.
I didn't mean to sound rude - sorry if that was the case. I just don't know how programs work at all.
I am very grateful for dosbox and all its funcionalities.
Thanks for spending your time in such a great program and in helping me.

Cheers!
V