• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: cocoa-dev digest, Vol 2 #1500 - 17 msgs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cocoa-dev digest, Vol 2 #1500 - 17 msgs


  • Subject: Re: cocoa-dev digest, Vol 2 #1500 - 17 msgs
  • From: James Derry <email@hidden>
  • Date: Sun, 10 Nov 2002 10:44:04 -0500

On 11/9/02 6:16 PM, Anthony Duer <email@hidden> wrote:

> Hello,
>
> In a application I'm continuing, I'm attempting to set up Internet
> Explorer to download a file from a website, which I'd like to parse.
> I've set up my application to respond to application: openfile:, but I
> can't seem to get the file type/file creator to stick when I attempt to
> set it in Explorer. I think the problem is that my application isn't
> claiming ownership of the file type/file creator. What would be the
> settings in the document types in the active target editor I'd need to
> set for a file type/file creator? The type I'm trying to respond to is
> 'play' and the creator is 'wZsC'.
>
> ~Anthony Duer

Anthony, at what point aren't they sticking? Are you saying that when
Explorer saves the file, Explorer isn't setting the file/creator? Is there a
problem with depending on the file extension only? I ask because as nice as
file/creators are, we're not supposed to use them anymore, so it may be that
Explorer won't set type/creator codes.

Really, though, if you set up your application as a helper application in
Explorer, your documents get opened in your application, right? Or are they
being opened by the default system program based on the extension instead of
yours?

If the problem is that the type/creator aren't being saved to the file after
your application changes the file somehow, that's normal Cocoa behavior
since, again, it seems we're not supposed to use type/creators. However,
I've found that by overriding fileAttributesToWriteToFile in your NSDocument
subclass, you can use them anyway. Here's a working example from my own
program that works with HTML/PHP files:

- (NSDictionary *)fileAttributesToWriteToFile:(NSString *)fullDocumentPath
ofType:(NSString *)documentTypeName
saveOperation:(NSSaveOperationType)saveOperationType {
NSMutableDictionary *myDict = [[[NSMutableDictionary alloc]
initWithDictionary:[super fileAttributesToWriteToFile:fullDocumentPath
ofType:documentTypeName saveOperation:saveOperationType]] autorelease];
[myDict setObject:[NSNumber numberWithUnsignedLong:'WWS2']
forKey:NSFileHFSCreatorCode];
[myDict setObject:[NSNumber numberWithUnsignedLong:'TEXT']
forKey:NSFileHFSTypeCode];
return myDict;
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: "weak link" framework refs for 10.1 compatibility?
  • Next by Date: Re: Getting thumbnail of document to appear?
  • Previous by thread: Re: [Repost] Subclassing NSTableColumn
  • Next by thread: Path and new folders
  • Index(es):
    • Date
    • Thread