View Full Version : OSX: translate path with slashes to path with colons and volume name


void
06-24-2003, 09:48 AM
Hi all,

I need to convert a UNIX-path to a Mac OS X path.
For example:
/Applications/Chess.app
matches
Macintosh HD:Applications:Chess.app

and, if i'd added a Volume called 'project' to the system:

/Volumes/project/file.txt
matches
PROJECT:file.txt

How can I translate a UNIX-path to a Mac OS 9 style path?
This is possible using Applescript
(see http://macscripter.net/faq/general_osx.php), but I'd like
to do it on the commandline, or in Java.

I've searched google for about a day now, but it looks like
I'm the first to ask this question...

Thanks for your help,

Arjan

gkshenaut[at]ucdavis.edu
06-24-2003, 06:39 PM
Arjan Haverkamp <arjan[at]webpower.nl> wrote (Tue, 24 Jun 2003 15:12:54 +0200):
> Well, that's not what I mean.
> I have a Flash(SWF)-application that can only read files, when it is fed
> with old, MAC OS9-style paths like "Macintosh HD:Applications:....".
> Flash cannot read files on the Mac using the new Unix-style paths
> (/Applications/...).
> What I need is a way to translate the Unix-like paths to the old, OS9
> style paths.
> If Applescript can do it (http://macscripter.net/faq/general_osx.php),
> OSX should be able to do it on the commandline as well, right?

> All I need is a way to convert a Unix-style path to its corresponding
> OS9-style path (including the volume name!).

Are you sure that that would work? I got the impression (based on
"Mac OSX in a Nutshell") that old style colon paths work on only
on HFS+ filesystems, while new style slash paths work on UFS
filesystems, plus a few systems programs will accept slash paths
even on HFS+ filesystems. So, if the underlying filesystem is a
UFS volume, but the program rejects anything but HFS+ style paths,
then you are in trouble.

The "solution" may include involve the program and/or maintaining a
HFS+ partition or drive on your computer.

If there are only a few files involved, perhaps you could make a
work directory with symbolic links to wherever the files you need
are; then you would not need to specify the volume or directory in
the path???

Greg Shenaut