Deep Space

Wouter wouter.abraham at pi.be
Tue Sep 9 21:09:01 EDT 2003


Hi,

Receiving no use-revolution-digest because of
pop server maintenance over here I am sorry
posting if I got already corrected.

Several corrections on my previous posting.
The shell() method is returning chars like
numtochar(196) into something as
numtochar(198) & numtochar(146)
(my mail app is not showing them)
As I don't know this kind of encoding yet,
I did a simple replace for this character.
This means that languages which use diacriticals
can't use this version of the directory walker until
the conversion is solved.


on mouseUp
   put empty into field "result"
   answer folder "Pick a folder you want to walk:"
   if it is empty then exit mouseUp
   if last char of it <> "/" then put "/" after it
   put walkDir(it) into field "result"
end mouseUp

-- This recursive function expects a folder path.
-- It returns a file list for that folder and for each
--  sub-folder it contains (pre-order search)
-- Invisible files are excluded.

function walkDir dirPath
   #### to have something to read while waiting
   put  dirPath
   -- add 1 to isDepth
   -- if isDepth > limitDepth then
   -- put isDepth into limitDepth
   -- put limitDepth
   -- end if
   put empty into tList
   set defaultFolder to dirPath
   -- Dar's discovery. Check permissions were ok
   get the Result
   if it is not empty then
     -- subtract 1 from isDepth
     return empty
   end if
   put the long files into fList
   ### instead of the if statement in the repeat loop
   filter fList with "[!.]*"
   repeat for each line fLine in fList
     put  dirPath & item 1 of fLine & comma & last item of fLine & 
return after tList
   end repeat
   #### change to eliminate the aliases
   get shell("ls -F")
   filter it with "*[/]"
   #### shell() returns í for ƒ used in some cases to
   #### designate a folder
   replace "í" with "ƒ" in it   -- added
   set the itemDel to "/"
   #### to eliminate the apps -- changed
   #### comment out if not needed
  repeat for each line x in it
     if last item of dirpath = "Contents" and "MacOS" is in it and 
"Resources" is in it then
       put  dirPath & x & return after tList
       next repeat
    end if
     put walkDir(dirPath & x) after tList
   end repeat
   -- subtract 1 from isDepth
   return tList
end walkDir

Greetings,
WA
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 2351 bytes
Desc: not available
URL: <http://lists.runrev.com/pipermail/use-livecode/attachments/20030909/97098cda/attachment.bin>


More information about the use-livecode mailing list