The Directory Walker revisited

Dar Scott dsc at swcp.com
Thu Sep 4 23:04:01 EDT 2003


On Thursday, September 4, 2003, at 03:52 PM, David Vaughan wrote:

> Dar, I have had time only for a preliminary test but it appeared that 
> the apparent depth blew up past a relatively low limit, so, even 
> though no error is declared until later, there is a problem perhaps as 
> low as 20-50 leading to exploding false calls and an error at 700. I 
> am using 2.1 on OS X.
> If this has not been resolved by someone else by tomorrow I will have 
> a better look.

Permissions!

-- needs 3 fields; try /Users in field "Path"

on mouseUp
   set the cursor to watch
   put empty into field "Log"
   put -1 into field "Depth"
   put the defaultFolder into temp
   try
     listfolders field "Path"
   catch e
     put LF & "thrown error!" & LF after field "Log"
   end try
   set the defaultFolder to temp
end mouseUp

on listFolders path indent
   put max( length(indent)/2, field "Depth") into field "Depth"
   set the defaultfolder to path
   if the defaultFolder is not path then                        -- !
     put indent & "Can't set: "& path & LF after field "Log"    -- !
     exit listFolders                                           -- !
   end if                                                       -- !
   put the folders into folderList
   repeat for each line f in folderList
     if char 1 of f is not "." then
       put indent & f & LF after field "Log"
       set the scroll of field "Log" to 9999999
       listFolders (path & "/" & f), indent & "  "
     end if
   end repeat
end listFolders

It seems if the defaultFolder cannot be set, it is unchanged.
Most of what we have seen needs this check.

Recursion has been vindicated!!!
Uh, I'll sit down now.

Dar Scott





More information about the use-livecode mailing list