Ian Cheyne wrote:
>I don't want to know what types of "files" I am dealing with but I do want
>to know whether I am dealing with a real directory or a directory
>masquerading as a file (or application).
>
>What is the best way to determine this? Is it to check first of all whether
>Java believes that the file is a directory or not (using
>aFile.isDirectory()) and if it is then check to see if the name has an
>extension or not?
Yes, the first step is to check isDirectory().
After that, you might check the "bundle-bit", which is a Mac-specific
metadata bit. That's not easy without adding a library. My open source
MacBinary Toolkit can do it, but considering everything else it provides,
it might be overkill.
Also, I'm not sure if the bundle-bit is really set in these cases. You'd
have to check using the GetFileInfo command that's in the Developer Tools.
(I just tried GetFileInfo on some Xcode projects, and the bundle-bit isn't
set, so now I suspect pursuing bundle-bits may be fruitless.)
I can't remember if there's a list of suffixes that the Finder uses to
present dirs as files. I vaguely recall such a thing, but I could be
misremembering or imagining it. It might be a LaunchServices database.
Another "file" that's a directory is PB and Xcode projects. Ditto for
Installer packages.
The general terminology is that such directories are "packages", so try
searching ADC for that term. It might lead you somewhere useful. Packages
are often called bundles outside official docs, because the classical term
was "bundle bit", and because "package" already has a distinct Java meaning.
By the way, there are more things than directories that aren't files. On
Mac OS X, a symlink is neither, but appears to Java as whatever its
referent is. An alias-file appears as a file to Java, even an alias-file
to a directory (because Java doesn't resolve alias-files, though it does
resolve symlinks). There are also device nodes that are neither files nor
directories. And there are named pipes (FIFOs) that are none of the above
(read 'man fifo').
-- GG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden
This email sent to email@hidden