Alex Tweedly wrote:

> Following is a wild guess, and a request / suggestion for an
> investigation attempt.
>
> The start of the code in question   (from
> http://lessons.runrev.com/m/4071/l/17080-files-and-folders-part-2 )
> is
>
> *function*listFiles pFolder, pRecurse
> *    local*tTotalFiles, tCurrentFiles, tFolders
>
> *    set*thedefaultFoldertopFolder
> *    put*filteredFiles()intotCurrentFiles
>
> Now that is risky code !!
> If the "set the defaultfolder to pFolder" fails, then you remain in
> the
> same directory, and redo the same work, and get stuck in infinite
> recursion.  This could (maybe??) happen because of permission
> failures, or maybe folder naming issues, or something else I haven't
> thought of :-)
>
> So I would change it by adding as follows
>     set the defaultfolder to pFolder
>     if the defaultfolder <> pFolder then
> put "Failure :" && the defaultfolder && "::" && pFolder &CR after msg
>        exit listFiles
>     end if
>     ...
>
> and see what that does.

Good catch. 400000 is a deep folder hierarchy, and I've seen the recursion error very early on, suggesting that the problem isn't traversing the folders at all, but merely that it can't access some because of permission errors.

It might be nice to have that sample stack updated to skip folders it doesn't have permission to access (or can't access for some other reason), while returning all files it can access successfully.

--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 ____________________________________________________________________
 ambassa...@fourthworld.com                http://www.FourthWorld.com

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to