Finding the current folder ?

Alex Tweedly alex at tweedly.net
Thu Oct 21 17:01:26 EDT 2004


I want to place my app in a folder, and then when it runs, have it read 
(and write) files in that folder. I don't want to query the user for the 
file names - it should simply use the files in the same directory as the 
app is installed.

I've been using something like
>function getDefaultFolder
>   put the long name of this stack into thisFolder
>   put char 2 to -1 of the second word of thisFolder into thisFolder
>   set the itemDel to "/"
>   put item 1 to -2 of thisFolder into thisFolder
>   return thisFolder
>end getDefaultFolder

which works fine whether in the IDE or in standalone, and works fine when 
built into an executable and installed on other machines.

BUT - it doesn't work on Dreamcard Player. If you run he player, and then 
load the stack from there, the above function returns empty (in fact, the 
"long name of this stack" is simply
<<stack "stackname">> where in the other cases it would be <<stack 
"D:/path/filename.rev">>

Note that dreamcard appears to return the format for a long name, but 
instead of giving the filename of the stack, it gives, in quotes, the 
shortname of the stack.

Is this a bug (I'm guessing it is) ?
Or am I doing something wrong ?  (and if so, what ?)

Any other suggestion for how to find the folder the app is stored in ?

btw - if you run the stack in Dreamcard by double-clicking on it, and 
having an association with the Dreamcard player, then it does this as I 
would expect. Unfortunately, it does various other things wrongly, and Mark 
tells me this is not a supported way to run Dreamcard stacks - see BZ 2138)

Thanks
-- Alex.



More information about the use-livecode mailing list