Problem: 1351352

Title: (Files) FileHandler and Stationary

Received: May 20 1996 3:55PM


In recently posted message, I said:

Not a bug exactly, but I'd like to be able to save a document as its stationery. I override TDocument::AboutToSaveFile to alter the file type, creator and stationery flag of the save file. Problem is, when TFileHandler::GetSaveInfo sets up the finder data, it neglects to set the appropriate stationery bit.

How about adding:

if (fFile->fStationery)
   cInfo.hFileInfo.ioFlFndrInfo.fdFlags |= kIsStationery;
else
   cInfo.hFileInfo.ioFlFndrInfo.fdFlags &= ~kIsStationery;
Sorry, but even this won't work. Problem is that TFileHandler uses the results of GetSaveInfo (the CInfoPBRec) only when fFileExists && copyFInfo (that is, the file to be saved has a representation on the disk (ie: it HAS a CInfoPBRec) and therefore has finder info to use. Otherwise (as in the case of trying to save a file as its stationery), the file created in ::SaveViaTemp or ::SaveInPlace is newly created with just fFileType and fCreator, no mods to finderInfo. I can get fFileType set appropriately, but can't set the IsStationery bit. I'm working on it, but the above doesn't do anything.
Fix:
UFileBasedDocument.cp:
  TFileBasedDocument:
    GetSaveInfo: now sets stationery settings.
Other places where cInfo should be used have already been modified to retrieve cInfo.