Re: symlinks, lstat, relative/absolute combos
Re: symlinks, lstat, relative/absolute combos
- Subject: Re: symlinks, lstat, relative/absolute combos
- From: James Peach <email@hidden>
- Date: Tue, 22 Mar 2011 11:03:15 -0700
On 22 March 2011 06:08, Steven Abner <email@hidden> wrote:
> Hi ,
> I was working on Mac symlinks(unix style) and encountered things I couldn't find information on through web searches.
> I was thinking these are Mac specific flags and meanings, so with that intro: when you lstat() a symlink, lstat states that
> st_size will be the size of the pathname for the link, what does it mean when it is a link with st_size = 0, yet it does have a link?
I believe that the st_size of a symlink is a filesystem implementation
detail. You should not rely on it for anything serious.
> And what is the special meaning of a return when it mixes relative paths with absolute paths? Example: a return of ../..//System .
>Should "../../" be ignored and jump to System directory of of root? Or is "/" before "System" suppose to mean ignore me please?
>Currently my code just returns "//" is an error.
No. Any number of '/' characters is legal and is the same as a single
'/'. Any number of '/./' path components is also legal and is also the
same so a single '/'.
> As I read it: from here (relative path) go to parent (..), from here (/) go to parent (..)
> from here (/) go to (/System). Or is "//" an abbreviated "/./" , which currently seems unsupported?
So to process the path "../..//System", take the current working
directory, go back one path component for each ".." component, then
append one component named "System". Wherever you end up after that is
the right place.
Note that the path "/../../.." resolves to just "/". That is, the
parent directory of "/" is "/". You can trivially demonstrate this my
doing "cd /../../../../."
--
James Peach | email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden