Paths in Mac standalone headache

Richard Gaskin ambassador at fourthworld.com
Sat Oct 10 15:39:54 EDT 2015


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
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com




More information about the use-livecode mailing list