On Mar 7, 2010, at 4:47 PM, Mark J. Reed wrote: Might I suggest something like this?
set filenames to paragraphs of (do shell script "ls -1d " & (quoted form of posix path of prefsRef) & "/" & prefIdent & "*")
Following your suggestion, I replaced the offending line with a call to this handler.
on getItemsStarting(prefIdent, prefsRef) set AppleScript's text item delimiters to {return} quoted form of (POSIX path of prefsRef) try do shell script "ls -1dp " & the result & prefIdent & "*" on error return {} end try set pathList to text items of the result -- set aliasList to {} repeat with i from 1 to (count items of pathList) item i of pathList if last character of the result is not "/" then (POSIX file the result) as alias set aliasList to (aliasList & {the result}) end if end repeat return aliasList end getItemsStarting --------------------------------
Oooooooooooooooo! (I learned to spell with Cheerios.) I've got my speed back!
The man page for 'ls' does not include any explanation for the '& "/" & prefIdent & "*"'. The "*" probably tells 'ls' to find names beginning. What is the "/" for? (I was sure I would find the answer when I removed it, but it worked anyway.)
And more importantly ... Why can't Snow Leopard do this? The fact that a 'do shell script ...' works indicates a bug here.
|