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

Re: [MacPerl] Portable way to implement GetFileInfo?



At 11:48 AM -0700 4/27/99, Brenda Cannon wrote:
>Hi,
>
>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.
>
>Any help is greatly appreciated.
>
>Brenda
>
>===== Want to unsubscribe from this list?
>===== Send mail with body "unsubscribe" to macperl-request@macperl.org

I haven't checked into whether this can be done in Perl or not since I
don't have it installed on my PC.

The extension of the file -- either in what is shown normally OR in the
MS-DOS name shown in the properties -- is the only way to tell what the
file is.  These don't have to be the same and most of the time aren't the
same.  I'm assuming that the Windows version has a way of getting the shown
name (ie. "Microsoft Word") as well as the MS-DOS name (ie, "WINWORD.EXE").

The only portable way to do this (that I'm aware of) is to check for what
platform you're running on in an if...elsif...endif block.  Good luck.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Dennis Little			       mailto://dennis.j.little@lmco.com
Lockheed Martin Missiles & Space       mailto://metnet@worldnet.att.net
Sunnyvale, CA			       Web: http://www.lmms.lmco.com/
Phone: 408/756-2170		       LMMS: O/EA52 B/076 C/3E8
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



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