File Walker
Richard Gaskin
ambassador at fourthworld.com
Tue Sep 30 11:20:32 EDT 2014
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
____________________________________________________________________
Ambassador at FourthWorld.com http://www.FourthWorld.com
More information about the use-livecode
mailing list