[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Portable way to implement GetFileInfo?



On Tue, 27 Apr 1999 11:48:58 -0700, Brenda Cannon wrote:

>I can do the following in MacPerl to determine the type of a file:
>
>$file_type = MacPerl::GetFileInfo("$image_dir:$file_name");
>
>$file_type then contains something like 'MooV', etc. Is it possible to
>do the same thing in a Windows environment without actually looking for
>the extension (the extension won't be there for the problem I have)?  If
>so, I am looking for a portable way to do this on both platforms.

The file extension *is* the Windows equivalent of the filetype. I's part
of the name, yes, while it's a separately stored entity on the Mac. But
for the rest, it's virtually the same.

The only other thing you can use, is actually look into the file, and
use some heuristics on what kind of file it actually could possibly be
("Is it a JPEG?"), depending on some byte sequences that typically
appear at certain places in the file. MSIE has a tendency to do this. I
hate this "smart-ass" behaviour, as there's no way to avoid it. For
example, it insists on showing CMYK JPEG images, though it cannot handle
them.

If you can, add appropriate file extensions.

	Bart.

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org