easy way to pack application that run off from CD-ROM?

zhangweiwu

Registered
Hello. I recently try to make an application to run on all of Linux, Mac
OS and Windows, on the CD-ROM. It does not come with an installer (green
software), and user was supposed to run the application directly from
the CD-ROM.

First I make sure the application runs fine by launching from
commandline (xterm in Linux, CMD.exe in Windows, Terminal in Mac OS).
This is tested on all 3 operating systems, the software runs just fine
on all 3 OSs.

Then I make shortcut for Windows, put the commandline to
"windows_start.cmd", Windows user should double click this file, it
works fine.

Then I make shortcut for Linux, put the commandline to "linux_start.sh",
Linux user should double click this file, it works fine.

Then I try to make a shortcut for Mac OS 10.5, suddenly realized there
is no known file format in Mac OS that I can put a line of command into
it. ".sh" is not recognized by Finder (it should be, because Mac OS
Terminal can run .sh files), ".tcl" is also not recognized by Finder
even though I can run it from Terminal. Neither ".cmd". ".lnk" of course
I don't expect it can be recognized. My question is, is it true in Mac
OS that there is no file format that allow me to embed a command line?

The closet thing I found is a tutorial on how to package a .app
directory which would look like a single program. The method itself is

1. pretty complicated
2. require me to put a copy of the program following Mac OS .app
folder hierarchy, which is not compatible with the existing CD
file hierarchy.
3. I could not find a way to specify commandline parameter, which is
actually pretty important in our case. Then if I must use .app
folder, I must find a way to wrap my application to another one
which calls my application with a few commandline parameter, e.g.
wrap it in .sh or .tcl file. Is this the right way to go?


I am sure there is a way to run application in Finder without following
.app folder hierarchy, because I saw once an application look like an
application in Finder, while in Terminal it is really a single file. But
I am not sure if this way is scriptable.



Thanks in advance!


P.S.
There are two types of "application shortcuts".

One type is executable script, in Windows there are .bat, .cmd, .wsh; In
Linux there are .sh, .tcl, .py; each allows you to put a line of command
to call there, with parameter, and allow user to dobule-click it to run
the command. On Mac OS I don't know any equivalent, if there is one, the
problem is solved.

The other type is shortcut file format. In Windows there is .lnk, in
Linux there is .desktop. The shortcut format contain a line of command
and other optional information like what icon to be used. Linux .desktop
format is pretty strong, allowing the file name displayed differently
according to user preferred language. User can double-click such
shortcuts to start application. If there is one such format in Mac OS,
the problem is also solved. But I googled and could not discover such thing.
 
After a month's research and try different methods, now I can answer my own question.

The equivalent of Microsoft .cmd file extension is .command file extension in Mac OS X. Both are not the "best" way to start GUI application because both opens a terminal Window which offers little feature except allowing user to STOP the application with Ctrl+C and to see console error messages. They differ only in that Mac OS X require the .command also have execution bit set, and Mac OS X always launches it in user's home directory instead of where the file residents, thus it is helpful to add "cd `dirname $0`" as the first statement in .command file.

It seems the old "SetFile -t APPL" method of setting APPL type code doesn't work on 10.5, at least not for me.

There are multiple other ways to "make" an application run on Mac OS X, most common being making an application bundle. But that require a hierarchy of software and its libraries that might not be compatible with a software already made targeting a different platform. And with modern business expedience this might not be easy or worthy to fix. Thus I still think .command can be used a lot.
 
Back
Top