David V Glasgow wrote:

> On 6 Oct 2015, at 2:52 am, Richard Gaskin wrote:
>
>> when the culprit was simply a defaultFolder assignment that didn't
>> take.
>
> Thanks.  Helpful scripts both.  I think it *is* simply a folder
> assignment that doesn’t take.  Not the default folder, but the
> path to the results which I temporarily switch to.
>
> So, Richard, once you had identified the culprit in your directory
> walker script, what did you do?

What we did for years before it occurred to us to add adequate error-checking was to spend way too much time pondering recursion. :)

Once we discovered that the recursion was happening not because we had directory structures more than 400,000 folders deep but simply because "set the directory..." was failing so we kept attempting to get the files of the same directory, we stopped doing that.

More specifically, since the directory walker is attempting to walk all folders within a given folder, if "the result" is not empty when attempting to set "the directory" to any one of them we just skip that and move on to the next.

With Mac Classic, where many of us developed our habits (both good and bad), the file system had no permissions so setting the directly almost never failed as long as the path was valid. On modern OS X and Linux systems, file system-level permissions are a key part of the improved security available with those OSes, so now access to a folder is something we should no longer take for granted.

I just did a quick search via Google to try to find that thread from earlier this year, but came up empty. If anyone here has better luck it may be useful to review it.

If you need a directory walker the function at the top of this page will suffice if you add error-checking after the "set the directory" line:
<http://sonsothunder.com/devres/livecode/tips/file007.htm>

The longer form below it on that page isn't really needed unless you have directories nested more than 400,000 deep (likely to result in an inode shortage long before you have an opportunity to traverse it in LiveCode <g>).

--
 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