Re: Converting an Absolute path to a relative path?
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