• 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: test if folder contains file based on NSURLs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: test if folder contains file based on NSURLs


  • Subject: Re: test if folder contains file based on NSURLs
  • From: Lee Ann Rucker <email@hidden>
  • Date: Fri, 30 Apr 2010 12:03:50 -0700

It also depends on if they were composited identically.

This is how I do it:

- (BOOL)isEqualToURL: (NSURL *)inURL // IN
{
   if (![self isFileURL] || ![inURL isFileURL]) {
      return [self isEqual:inURL];
   }

/*
* [NSURL isEqualTo:] fails when a path has a trailing slash and
* an otherwise matching one doesn't. Standardize the path first
* and use localizedCompare in case the characters were composited differently.
*/
if ([[[self path] stringByStandardizingPath]
localizedCompare:[[inURL path] stringByStandardizingPath]] == NSOrderedSame) {
return YES;
}
return NO;
}


On Apr 30, 2010, at 6:12 AM, Howard Siegel wrote:

That will only work if all of the NSURLs all either absolute or relative,
and are all either based on the same physical folder paths or are based on
the same set of aliases/links. If there are different paths based on
different aliases or links, then they won't match.


You might think about using getting the inodes from the NSURLs and using
them for the comparisons.


- h

On Thu, Apr 29, 2010 at 19:59, Rainer Standke <email@hidden> wrote:

Hello,

I have a bunch of NSURLs for existing files on the system, and a smaller
number of NSRURLs for their enclosing folders. I am looking to determine if
a given file is within a given folder, based on their URLs.


Right now I am thinking that I'll have to create the enclosing folder's URL
by removing the last component, and then compare that to the folder URL.


Is there a better way? Thanks!

Rainer_______________________________________________

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

_______________________________________________

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: 
 >test if folder contains file based on NSURLs (From: Rainer Standke <email@hidden>)
 >Re: test if folder contains file based on NSURLs (From: Howard Siegel <email@hidden>)

  • Prev by Date: the case of the missing scroll bar
  • Next by Date: Re: Matching the style of a HUD?
  • Previous by thread: Re: test if folder contains file based on NSURLs
  • Next by thread: Re: test if folder contains file based on NSURLs
  • Index(es):
    • Date
    • Thread