• 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: Best way to build relative pathname?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Best way to build relative pathname?


  • Subject: Re: Best way to build relative pathname?
  • From: "M. Uli Kusterer" <email@hidden>
  • Date: Mon, 12 May 2003 14:30:13 +0200

At 11:32 Uhr +0200 12.05.2003, Lorenzo wrote:
In Project Builder you can easily take a look at the
"NSString (Objective C)" help file or "NSPathUtilities.h" file
To do that (if you don't know yet) go to the Find panel
then start a search for "NSPathUtilities". Then click on the "book" icon in
the result list.

Lorenzo,

yes, I found NSPathUtilities. But what I actually need is to go

FROM:

"/Users/witness/Documents/file.jpg"
and "/Users/witness/"

TO:

"Documents/file.jpg"

Where the paths can be arbitrary. What I'm currently doing is finding the range of the second path (folder path) in the first path (file path) and then delete that range from the string, which gets me the proper result in the most common case.

Sadly, if the file path was "/Users/file.jpg", the correct relative pathname would be "../file.jpg", which this obviously won't yield.
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
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.
  • Follow-Ups:
    • Re: Best way to build relative pathname?
      • From: Greg Titus <email@hidden>
References: 
 >Re: Best way to build relative pathname? (From: Lorenzo <email@hidden>)

  • Prev by Date: Inconsistencies with NSString in GDB
  • Next by Date: network address, how to find
  • Previous by thread: Re: Best way to build relative pathname?
  • Next by thread: Re: Best way to build relative pathname?
  • Index(es):
    • Date
    • Thread