Creator Code for Packages

  • I have a document based application which creates rtf or rtfd things.

    Overriding
    fileAttributesToWriteToURL:ofType:forSaveOperation:originalContentsURL:e
    rror:
    I set NSFileHFSCreatorCode.

    This has the intended result that rtf files created by my app can be
    opened with TextEdit, while my app is the default.

    How can I get the same for rtfd-directories (folders/ packages) -
    i.e. a directory which can be opened with TextEdit, while my app is
    the default ?
    (I do not want my app to be the default for all rtfd directories,
    only for stuff it has created).

    And: Where is the CreatorCode stored in the case of directories?
    For files it seems to get stored in:
    HFSPlusCatalogFile.FndrFileInfo.fdCreator - but I don't see anything
    equivalent in HFSPlusCatalogFolder.

    Gerriet.
  • On Oct 31, 2006, at 7:15 AM, Gerriet M. Denkmann wrote:

    > I have a document based application which creates rtf or rtfd things.
    >
    > Overriding
    > fileAttributesToWriteToURL:ofType:forSaveOperation:originalContentsURL
    > :error:
    > I set NSFileHFSCreatorCode.
    >
    > This has the intended result that rtf files created by my app can
    > be opened with TextEdit, while my app is the default.
    >
    > How can I get the same for rtfd-directories (folders/ packages) -
    > i.e. a directory which can be opened with TextEdit, while my app is
    > the default ?
    > (I do not want my app to be the default for all rtfd directories,
    > only for stuff it has created).

    From "Document Packages", at <http://tinyurl.com/tx595> (*):

    "Document packages should always have an extension to identify them—
    even though that extension may be hidden by the user. The extension
    allows the Finder to identify your document directory and treat it as
    a package. You should never associate a document package with a MIME
    type or 4-byte OS type."

    *Long URL: <http://developer.apple.com/documentation/CoreFoundation/
    Conceptual/CFBundles/Concepts/DocumentBundles.html
    >

    sherm--

    Web Hosting by West Virginians, for West Virginians: http://wv-www.net
    Cocoa programming in Perl: http://camelbones.sourceforge.net
  • On 31 Oct 2006, at 13:48, Sherm Pendley wrote:

    > On Oct 31, 2006, at 7:15 AM, Gerriet M. Denkmann wrote:
    >
    >> I have a document based application which creates rtf or rtfd things.
    >>
    >> Overriding
    >> fileAttributesToWriteToURL:ofType:forSaveOperation:originalContentsUR
    >> L:error:
    >> I set NSFileHFSCreatorCode.
    >>
    >> This has the intended result that rtf files created by my app can
    >> be opened with TextEdit, while my app is the default.
    >>
    >> How can I get the same for rtfd-directories (folders/ packages) -
    >> i.e. a directory which can be opened with TextEdit, while my app
    >> is the default ?
    >> (I do not want my app to be the default for all rtfd directories,
    >> only for stuff it has created).
    >
    > From "Document Packages", at <http://tinyurl.com/tx595> (*):
    >
    > "Document packages should always have an extension to identify them—
    > even though that extension may be hidden by the user. The extension
    > allows the Finder to identify your document directory and treat it
    > as a package. You should never associate a document package with a
    > MIME type or 4-byte OS type."
    >
    > *Long URL: <http://developer.apple.com/documentation/CoreFoundation/
    > Conceptual/CFBundles/Concepts/DocumentBundles.html>

    Thanks very much for this link.
    Do I have to read: "You should never associate..." as: "You can never
    associate..." ?

    Kind regards,

    Gerriet.
  • On 31 Oct 2006, at 13:48, Sherm Pendley wrote:

    > On Oct 31, 2006, at 7:15 AM, Gerriet M. Denkmann wrote:

    Although the documentation for NSFileManager says that "keys, such as
    NSFileHFSCreatorCode and NSFileHFSTypeCode, do not apply to
    directories" (which makes sense, because HFS+ has no room to store
    this) there is a way to set TypeCode and CreatorCode for directories.

    Just insert into your directory another directory called "Contents"
    which contains a file called PkgInfo which contains a string of 8
    characters with TypeCode and CreatorCode (e.g. "????MyAp")

    This was pointed out to me off list by some friendly and knowledgable
    person.

    Gerriet.
previous month october 2006 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today