Re: How to get all the path of an application present on the disk
Re: How to get all the path of an application present on the disk
- Subject: Re: How to get all the path of an application present on the disk
- From: Tim Schröder <email@hidden>
- Date: Thu, 21 Mar 2013 20:49:41 +0100
.. yes, this is funny. There is a kMDItemPath attribute in the NSMetadataItem array, but calling [item attributes] won't show it. See https://developer.apple.com/library/mac/#documentation/Carbon/Reference/MetadataAttributesRef/Reference/CommonAttrs.html#//apple_ref/doc/uid/TP40001694-SW1 for a complete list of attributes present.
You can retrieve the path by either calling [metadataItem valueForAttribute:@"kMDItemPath"], or, introduced in OS X 10.7, [metadataItem valueForAttribute:NSMetadataItemPathKey].
Tim
Am 21.03.2013 um 08:36 schrieb anni saini <email@hidden>:
> Thanks Tim, I tried it however I won't able to find any path attribute. Search result is having following attributes:
> kMDItemContentTypeTree,
> kMDItemContentType,
> kMDItemPhysicalSize,
> kMDItemLanguages,
> kMDItemKind,
> kMDItemDisplayName,
> kMDItemContentModificationDate,
> kMDItemContentCreationDate,
> kMDItemDateAdded,
> kMDItemLogicalSize,
> kMDItemAlternateNames,
> kMDItemExecutableArchitectures,
> kMDItemCFBundleIdentifier,
> kMDItemVersion,
> kMDItemUsedDates,
> kMDItemLastUsedDate,
> kMDItemUseCount,
> kMDItemFSName,
> kMDItemFSSize,
> kMDItemFSCreationDate,
> kMDItemFSContentChangeDate,
> kMDItemFSOwnerUserID,
> kMDItemFSOwnerGroupID,
> kMDItemFSNodeCount,
> kMDItemFSInvisible,
> kMDItemFSTypeCode,
> kMDItemFSCreatorCode,
> kMDItemFSFinderFlags,
> kMDItemFSHasCustomIcon,
> kMDItemFSIsExtensionHidden,
> kMDItemFSIsStationery,
> kMDItemFSLabel
>
> ~Anni
> From: Tim Schröder <email@hidden>
> To: anni saini <email@hidden>
> Cc: "email@hidden" <email@hidden>
> Sent: Wednesday, 20 March 2013 4:39 PM
> Subject: Re: How to get all the path of an application present on the disk
>
> I don't have the code at hand, but you could run a NSMetadataQuery and search for kMDItemCFBundleIdentifier==abc.xyz.
>
> Best, Tim
>
> Am 20.03.2013 um 13:08 schrieb anni saini <email@hidden>:
>
> > Hi,
> >
> > I'm tried to find out all the locations where my app is present on the disk. Is there any Cocoa API which returns an array of path of an application.
> >
> > For example: my app identifier is "abc.xyz" and name is "ABCXYZ". I have four copies of app on the disk so I want to find out all the paths.
> >
> > I'm able to find it using:
> >
> > - (NSString*)fullPathForApplication:(NSString*)appName;
> > or
> > LSFindApplicationForInfo()
> >
> > Both methods return the single path. I want all the path of my app which are located on the disk?
> >
> > Thanks,
> > Anni
> > _______________________________________________
> >
> > 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