Paths in Mac standalone headache

Richard Gaskin ambassador at fourthworld.com
Mon Oct 5 21:52:48 EDT 2015


John Dixon wrote:
 > Would this help you in setting the defaultfolder
 >
 > on preOpenStack
 >    set itemDel to "/"
 >    set the defaultfolder to item 1 to -2 of \
         (the effective fileName of this stack)
 > end preOpenStack

We've become so used to defaultFolder working that most of us don't do 
as much error-checking as we should.  A lot of us spend way too much 
time last year tracking down what we thought were recursion limits in a 
directory walker when the culprit was simply a defaultFolder assignment 
that didn't take.

To rule that out here I'd add a check of the result with sysError:

on preOpenStack
  set itemDel to "/"
  set the defaultfolder to item 1 to -2 of \
       (the effective fileName of this stack)
  if the result is not empty then
    answer "Couldn't set defaultfolder: "& \
      the result &" ("& sysError()&")"
  end if
end preOpenStack

You may never need it, but if there's a reason that's failing at least 
you'll know what the OS thinks it is.

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