• 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: Where did the icon come from?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Where did the icon come from?


  • Subject: Re: Where did the icon come from?
  • From: Eric Gorr <email@hidden>
  • Date: Sat, 17 Jul 2010 06:57:28 -0400

Quite true, but in this case, I am pretty sure that is not what is happening. If my assumptions about what the code below is doing are correct, it will provide the debugging information I need.

Fortunately, I have physical access to the machine where the problem is occurring and can verify they haven't done something like you did with TextMate.

Thanks again.


On Jul 17, 2010, at 2:18 AM, John Joyce wrote:

> You might be going about it wrong.
> A user can, in Finder's Get Info window, set the application they prefer for all files of a given "type".
> On my system I've set some text file types to always open in TextMate, for example.
> TextMate the app provides custom file icons for all the file types it can save in.
> After making this change in Finder's get info windows, all files of that type will have an icon that has been provided by TextMate and registered with a UTI.
>
> At the end of the day, a user or another UTI more specific than yours may set the file icon regardless of what you want it to be.
>
> On Jul 16, 2010, at 5:50 PM, Eric Gorr wrote:
>
>>
>> On Jul 16, 2010, at 6:31 PM, James Walker wrote:
>>
>>> On 7/16/2010 2:45 PM, Eric Gorr wrote:
>>>> Thanks, but I wasn't specific enough.
>>>>
>>>> What I am looking for is something like this:
>>>>
>>>> $WhoProvidedIcon /Path/To/file.myex
>>>>
>>>> UTI: com.myapplication.document
>>>> PLIST: /path/to/myapplication.app/Contents/Info.plist
>>>> ICON: /path/to/myapplication.app/Contents/Resources/BaseDoc.icns
>>>
>>> Perhaps you could get some of this information by first using UTTypeCreateAllIdentifiersForTag to get the possible UTIs for the extension, and then passing each UTI to UTTypeCopyDeclaringBundleURL and UTTypeCopyDeclaration.
>>
>> Gotta love it when you learn about functions you were unaware of  previously.
>>
>> I don't think I need UTTypeCreateAllIdentifiersForTag....NSWorkspace should give me the UTI for the file.
>>
>> So, This code is probably all I need:
>>
>> 	NSString* uti = [ws typeOfFile:@"/Users/egorr/Desktop/file.vwx" error:&error];
>>
>> 	NSLog( @"UTI: %@", uti );
>> 	NSLog( @"UTI localized description: %@", [ws localizedDescriptionForType:uti] );
>> 	NSLog( @"UTI error description: %@",[error localizedDescription] );
>>
>> 	NSURL*	utiDeclarationURL = (NSURL*)UTTypeCopyDeclaringBundleURL( (CFStringRef)uti );
>>
>> 	NSLog( @"UTI declaration URL: %@", utiDeclarationURL );
>>
>> 	NSDictionary*	utiDeclaration = (NSDictionary*)UTTypeCopyDeclaration( (CFStringRef)uti );
>>
>> 	NSLog( @"UTI declaration: %@", utiDeclaration );
>>
>> (Also gotta love the toll-free bridging...)
>>
>> Of course, I'll edit the obtaining the uti to take a path from the command line.
>>
>> Doesn't quite give me the path to the icon, but does get me to the application which the declaration came from for the UTI.
>>
>> As long as all of this matches what the OS will do, then I should be good to go for my situation.
>>
>> p.s. Yes, I know that the icon for a file may not be an icon at all, but an image provided by a Quick Look plugin...but in my case, I know that it is an icon and not something provided by a Quick Look plugin. But, it would be interesting if one could determine exactly where the image for the file was coming from. The code above won't do that.
>>
>>
>> _______________________________________________
>>
>> Cocoa-dev mailing list (email@hidden)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Where did the icon come from? (From: Eric Gorr <email@hidden>)
 >Re: Where did the icon come from? (From: John Joyce <email@hidden>)
 >Re: Where did the icon come from? (From: Eric Gorr <email@hidden>)
 >Re: Where did the icon come from? (From: James Walker <email@hidden>)
 >Re: Where did the icon come from? (From: Eric Gorr <email@hidden>)
 >Re: Where did the icon come from? (From: John Joyce <email@hidden>)

  • Prev by Date: Re: Data downloading performance
  • Next by Date: Re: How do I refresh NSTableView after programmatically changing bindings on a dataCell
  • Previous by thread: Re: Where did the icon come from?
  • Next by thread: Re: Where did the icon come from?
  • Index(es):
    • Date
    • Thread