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

Re: [MacPerl] Creating a Resource Fork in a Text File Created with MacPerl



On Thu, 6 Nov 1997 10:52:16 +0100 Christian Huldt wrote:
>At 5:28 pm +0100 05.11.97, Philippe de Rochambeau wrote:
>>How do you create a resource fork in a text file which you have just created
>>with the Perl 'open' command? ... I am currently writing a program that
>>creates HTML files on the fly. I would like to create resource forks in
>>those files so that they appear as BBEdit files. Changing the files'
>>Creator does not make them appear as BBedit files because they lack resource
>>forks ...
>
>As other has stated, it suffices to change the creator, this will however
>mot appear until the finder has updated them. Closing and re-openeing the
>window or doing a 'get info' on them will cause finder to update

True, but there are two other things that can be done to force the Finder
to look at the file:

        a)  update the modification date of the folder containing the file
        b)  reset the file's 'init' flag

Both of these can be done with 'Mac::Files' through 'ioDrMdDat' and
'fdFlags'. Generally one would set 'ioDrMdDat' to 'time' and bit 8 of
'fdFlags' to zero.

There is some debate about whether or not the Finder takes any notice of
the state of the 'init' flag once it has entered the file's information
into the Desktop Database. However it does no harm to reset the flag: the
Finder will change it back again the next time it looks at the file.

Whilst in 'Mac::Files', so to speak, it might be elegant to use 'fdCreator'
to change the creator type as well.

This problem seems to be a feature of System 7xx: on System 8xx the Finder
appears to update the Icons immediately after changing the creator type
without the need to alter the folder's modification date or the file's
'init' bit.

Alan Fry.



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch