• 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: Converting an Absolute path to a relative path?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Converting an Absolute path to a relative path?


  • Subject: Re: Converting an Absolute path to a relative path?
  • From: Ondra Cada <email@hidden>
  • Date: Sat, 18 Sep 2004 23:34:57 +0200

Uli,

On 18.9.2004, at 23:01, M. Uli Kusterer wrote:

At 19:33 Uhr +0100 18.09.2004, Chris Ridd wrote:
This sort of conversion is notoriously difficult to get completely right...
Are you dealing correctly with multiple slashes in a path (e.g. foo//bar)
and links?

Actually, I thought that "//" was invalid in a path, so I'm not even accounting for them. What do they do?

Nothing. Actually, any number of slashes is equivalent to one slash.

I *think* the only foolproof way to do it is to use chdir to the absolute
path, and then chdir("..") until you end up in the folder with an inode the
same as the intended base.

Well, that only works when the path you're working with actually exists... That's also why I'm not accounting specially for links.

Well, yup, but *if* the path exists, you can get some pretty weird results...


Sorry if I'm giving you both egg-sucking instructions ;-)

I think my English is failing me here ?

English is not my native language either, but I believe there's a saying of "teaching one's grandma to suck eggs" in a sense of hinting at something which the hinted knows much better than the hinter :)
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: Converting an Absolute path to a relative path? (From: Chris Ridd <email@hidden>)
 >Re: Converting an Absolute path to a relative path? (From: "M. Uli Kusterer" <email@hidden>)

  • Prev by Date: Subclass NSArrayController in Java
  • Next by Date: RE: Converting an Absolute path to a relative path?
  • Previous by thread: Re: Converting an Absolute path to a relative path?
  • Next by thread: Re: Converting an Absolute path to a relative path?
  • Index(es):
    • Date
    • Thread