Does anyone know of a way to detect a symbolic link using newlisp functions? I suspect there is a straightforward way.
Consider the following:
> !ls -l
total 6432
lrwxr-xr-x 1 11 Dec 4 16:36 testpic -> testpic.eps
-rw-r--r-- 1 2602422 Dec 4 16:32 testpic.eps
> (file-info "testpic.eps")
(2602422 33188 0 501 0 1165271560 1165271558 1165271559)
> (file-info "testpic")
(2602422 33188 0 501 0 1165271560 1165271558 1165271559)
>
These look exactly the same to file-info.
One solution is use newlisp's exec command and parse out the "l" indicating a symbolic link. I'd prefer something faster and not dependent on "ls".
Thanks.
John
The next development version 9.0.6 (due 12/5 or 12/6) will distinguish in the mode field (2nd field) between links and original files.
Lutz
Aaa nice, then recurcive directory walks will finaly work under linux ;-)
Quote from: "newdep"
Aaa nice, then recurcive directory walks will finaly work under linux ;-)
yes - I had a problem in this respect when trying to write a find-duplicates script //http://newlisper.blogspot.com/2005/12/finding-duplicate-files-on-macos-x.html (one of my first newLISP scripts). I discovered that one of the Python guys had put a link to a file further up the directory tree in one of his applications:
/Users/me/Library/ScriptingAdditions/TextCommands.app/
Contents/Frameworks/Python.framework/Versions/2.3/Frameworks
/Python.framework/Versions/2.3/Frameworks/Python.framework/
Versions/2.3/Frameworks/Python.framework/Versions/2.3/
Frameworks/Python.framework/Versions/2.3/Frameworks/Python.
framework/Versions/2.3/Frameworks/Python.framework/Versions/
2.3/Frameworks/Python.framework/Versions/2.3/Frameworks/
Python.framework/Versions/2.3/Frameworks/Python.framework/
Versions/2.3/Frameworks/Python.framework/Versions/2.3/
Frameworks/Python.framework/Versions/2.3/Frameworks/Python.
framework/Versions/2.3/Frameworks/Python.framework/Versions/
2.3/Frameworks/Python.framework/Versions/2.3/Frameworks/
Python.framework/Versions/2.3/Frameworks/Python.framework/
Versions/2.3/Frameworks/Python.framework/Versions/2.3/
Frameworks/Python.framework/Versions/2.3/Frameworks/Python.
framework/Versions/2.3/Frameworks/Python.framework/Versions/
2.3/Frameworks/Python.framework/Versions/2.3/Frameworks/
Python.framework/Versions/2.3/Python
newLISP used to not like this (v8), but strangely it doesn't complain any more - just goes for about 40 circuits then appears to realise what's happening and moves on.... Lutz must've added some AI or something! ;-)