Using Command Line codes with Terminal in Mac OS X

General chat related to ScummVM, adventure gaming, and so on.

Moderator: ScummVM Team

Post Reply
Whaleyland
Posts: 6
Joined: Sat Jun 07, 2008 1:50 am
Location: San Diego, CA
Contact:

Using Command Line codes with Terminal in Mac OS X

Post by Whaleyland »

Alright, despite the fact that I was able to use terminal to compress basically every file for every ScummVM game I own, I am completely at a loss regarding opening a specific game via Terminal. I have read the Unix instructions, which Mac OS X basically is, and it states that

scummvm -f -p atlantis OR
/path/to/scummvm -f -p/path/to/atlantis/ atlantis

should basically work every time. Yet every time, I get an error that states scummvm doesn't exist. When I type it as scummvm.app, it states it is a directory. How do I freaking get a command line code to open Fate of Atlantis without making me actually open ScummVM and select it on the console screen? I am trying to make some nice little mini-application files so I don't have to go through the console every time, but I need to figure this part out first before I can get into the easier Automator stuff.

Help me forum, you're my only hope! (I know, cheesy but I am kinda desperate)
hippy dave
Posts: 129
Joined: Mon May 05, 2008 3:37 pm

Post by hippy dave »

the program file you need to run is actually hidden away inside the .app, so you have to do (depending on where your app is):

Code: Select all

/Applications/ScummVM.app/Contents/MacOS/scummvm  -f -p/path/to/atlantis/ atlantis
or similar.
Whaleyland
Posts: 6
Joined: Sat Jun 07, 2008 1:50 am
Location: San Diego, CA
Contact:

Post by Whaleyland »

I would just like to express how awesome you are for giving me that answer. Worked like a charm. Now onto Automator programming!
Whaleyland
Posts: 6
Joined: Sat Jun 07, 2008 1:50 am
Location: San Diego, CA
Contact:

How Do I Set a Variable/Updateable File Paths?

Post by Whaleyland »

Alright, the next question I have is similar to the first. Using

/Applications/ScummVM/ScummVM.app/Contents/MacOS/scummvm -f -p/Applications/ScummVM/atlantis/ atlantis

Worked beautifully, however is there any way to make it so the file paths will find their items without the /Applications/ScummVM/etc. path listed? I have tested numerous methods and they all give positive results, but the problem is when I try to move the ScummVM.app or the program folder, it won't update so the command line code stops working properly. Is there any way to make it so the command line code will work no matter where the app/program file is located? Thank.
fingolfin
Retired
Posts: 1452
Joined: Wed Sep 21, 2005 4:12 pm

Post by fingolfin »

Yes and no. IF you want to launch the scummvm binary directly from the ScummVM.app bundle wrapper, you will always have to specify the full path!

However, it would of course be possible to first search for ScummVM.app, then take that path to construct the shell command from it, by concatenating the path you found via searching, and the rest.

Not very elegant, but then you are abusing the system... ;). If I was you, I'd just install ScummVM.app in a fixed location to avoid that hazzle (but actually I'd just use the launcher ;).
hippy dave
Posts: 129
Joined: Mon May 05, 2008 3:37 pm

Post by hippy dave »

right, i've just been experimenting in the terminal, and found that making a "hard link" (this is a funky unix feature) can help you with this.

basically you will make a pretend file, in a specific location (for example, your home directory), and all this pretend file does is point to the real file that you specify. so telling the command line to run the pretend file, will make the real file run.

i've just checked, and with a hard link (as opposed to a symbolic link, which is a similar alternative), when you move the original (real) file to a new location, the pretend file will still point to it successfully. (i think this will only work if you move it around on the same volume - and the link (pretend file) has to be on that volume too. if more than one disk is involved then this method will probably fail)



so, what you do is...

Code: Select all

ln /Applications/ScummVM.app/Contents/MacOS/scummvm ~/scummvm
this will make the link (pretend file) in your home directory. so in future, running:

Code: Select all

~/scummvm -f blahblahblah
should continue to work even when you move ScummVM.app around (on the same disk).

edit: oh, i make no guarantees what will happen if & when you replace the ScummVM.app with a newer version etc. - but it's easy enough to delete the link (rm ~/scummvm) and make a fresh one with the above command.



...the easier option would be to keep ScummVM.app in one place ;)
Whaleyland
Posts: 6
Joined: Sat Jun 07, 2008 1:50 am
Location: San Diego, CA
Contact:

Post by Whaleyland »

That seemed to work well enough. How about moving the game files around? I tried the same technique as the .app, but it seems that since the files have no specific item to run, it doesn't work the same way. How can I assign a "soft link (?)" for the game files folder? I've been trying with Flight of the Amazon Queen but haven't had any luck. It only works if I document the full link in the command line code. Thanks again, by the way!

One other thing. Strangely, that technique seems to revert the ScummVM console to the older black and green version. Not quite sure why.
hippy dave
Posts: 129
Joined: Mon May 05, 2008 3:37 pm

Post by hippy dave »

yeah it goes green and black because it doesn't find the theme file. you might be able to work around this by putting the right file(s) in the right place relative to the scummvm link, but i expect it's not a very high priority.

and yes the game folder is more of a problem, because you can't use hard links for directories, and symbolic links don't follow to the new location when you move the target. i can't think of a solution for this i'm afraid.

is there a particular reason why you can't keep things in the same place tho?
User avatar
eriktorbjorn
ScummVM Developer
Posts: 3558
Joined: Mon Oct 31, 2005 7:39 am

Post by eriktorbjorn »

hippy dave wrote:yeah it goes green and black because it doesn't find the theme file. you might be able to work around this by putting the right file(s) in the right place relative to the scummvm link, but i expect it's not a very high priority.
Can't you simply set the Theme Path?
hippy dave
Posts: 129
Joined: Mon May 05, 2008 3:37 pm

Post by hippy dave »

oh yeah, probably then :) i haven't poked around in the prefs file to be honest :oops:
Post Reply