setting the default folder to the folder where the stack is..

Sjoerd Op 't Land sjoerdoptland at mac.com
Fri Dec 14 08:09:01 EST 2001


Jan Decroos wrote/ schreef:

> function getFolderFromFilename tFilename
>   put the itemDelimiter into savedDelimiter
    -- no need for this, because itemDel is local, and it will be reset
    -- for each handler, even running simultaneously
>   set the itemDelimiter to "/"
    -- good thing
>   delete last item of tFilename
>   return (tFilename&"/")
    -- could be written as:
    return item 1 to -2 of tFilename & "/"
>   set the itemDelimiter to savedDelimiter
    -- no need to this, for a reasen mentioned above
> end getFolderFromFilename

So, optimized we'd get:

function getFolderFromFilename tFilename
  set itemDel to "/"
  return item 1 to -2 of tFilename & "/"
end function getFolderFromFilename

Note: I wrote "set the itemDelimiter" as "set itemDel", because they're
equivalent, and it takes MC some piece of time for each char it has process.

So: "the shorter written, the faster compiled"

(I note for myself, that having used the starter kit for a long time, is a
good training for short-writing.)

Regards, / Groeten,
Sjoerd




More information about the use-livecode mailing list