@nonconventionally-creative, on Nov 25 2008, 03:12 PM, said in RezEditor Alpha Log:
No, because
1. it fails (if it follows similar structure to Linux with no arguments) given a non-symlink file with which to work
2. it doesn't resolve fully if it is a symlink to a symlink.
Both of these are resolved on Linux by the -f switch.
hey nc. just finished doing a hell of a lot of study. thought i'd stop by here and explain a few things.
# ln -s Documents/ sym
# readlink sym
Documents/
# ln -s sym sym2
# readlink sym2
sym
so readlink returns whatever the symlink points to. you'll need to check if the returned path is a link or a directory. if link, then readlink again until it's a directory. you can check this with stat. an @ after the path is a symlink, a / is a directory.
# stat -F sym2
lrwxr-xr-x 1 userName groupName 3 Nov 29 10:18:12 2008 sym2@ -> sym
# stat -F sym
lrwxr-xr-x 1 userName groupName 10 Nov 29 10:16:46 2008 sym@ -> Documents/
# stat -F Documents
drwx------ 18 userName groupName 612 Oct 22 23:47:16 2008 Documents/
alternatively, and i'm guessing this will be the best way(how i would do it anyway)
# stat -f "%T%Y" sym2
@sym
# stat -f "%T%Y" sym
@Documents/
# stat -f "%T%Y" Documents
/
hope this clears things up.
spanner in the works edit:
mac users don't use symlinks. they are used by posix users. macs use "Alias"'s. this is an even bigger kettle of red herrings. if i make an "Alias" in the Finder of my 'Documents' folder called 'Documents alias':
# ls -al Documents\ alias
-rw-r--r-- 1 userName groupName 0 Nov 29 10:43 Documents alias
# cd Documents\ alias
-bash: cd: Documents alias: Not a directory
# stat -f "%T%Y" Documents\ alias
#
# readlink Documents\ alias
#
the only way to resolve an "Alias" is to use AppleScript or some other scripting language(python, perl, maybe java). this would be way beyond the scope of what you are trying to do, unless you really do want to fill in all the gaps. here's a link for reference:
http://www.macosxhints.com/article.php?sto...021218054210294
This post has been edited by Tycho : 28 November 2008 - 08:00 PM