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

Re: [MacPerl-WebCGI] Changing File Types



_____
Could someone give me an example code snippet that changes a mac file 
type from one type to another?
_____


The first program I wrote, and I occasionally go back to rewrite it, and use it all the time involves filechanges. It of course has bunches of things that you can do with it now; but changing the file's "type/creator" pair comes down to all of one command...

MacPerl::SetFileInfo($creator, $type, $file);

Where $file is a path to the file. I'll assume for now that you know what to do with it (i.e. what it does, examples of t/c pairs,...) Another useful command that may come in quite handy is...

MacPerl::GetFileInfo($file);

Which returns a list ($creator, $type). If you want it to look like the standard syntax of mime or what have you, you can always...

print reverse join "/", MacPerl::GetFileInfo($file);

etc etc. If you'd like I can sent you a copy of my program. It's due for an update so may not bee too prety, but it gets the job done.

le meas,
--Nick

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