File paths in web-based stacks

Devin Asay devin_asay at
Fri Nov 3 15:21:21 EST 2006

On Nov 3, 2006, at 11:02 AM, Jim Ault wrote:

>> Of course, when you read your stack from a web server, it resides
>> completely in memory, so the filename is empty. So the routine above
>> does nothing.
> The defaultFolder is the one with the Rev app at startup.  You  
> could start
> there and get the user name and path to that folder, then create a  
> folder
> where you want.

Of course, all of this would work, but you'd have to have written all  
of your stacks anticipating that someday you might want to run them  
from a web server.
> Add 'try' to the defaultFolder
> or 'if the filename of this stack is empty'
> ..code
> setDefaultFolder
> ..code
> on setDefaultFolder
>> set the itemDelimiter to "/"
>> get the [effective] filename of this stack
>   if it is not empty then
>> set the defaultFolder to item 1 to -2 of it
>   else
>     --> use the base URL of the stack on the server
>   end if
> end setDefaultFolder


> Hope this is close to what you need.

In my case, I have dozens of example stacks that I have created over  
the years for my classes, none of which were written with the idea  
that they would someday be called from a web server. Now that I'm  
starting to do that, I don't really want to rewrite them all. So what  
I'm really asking is, is there a way to examine these stacks from the  
calling stack or standalone, check to see whether the default folder  
is set anywhere in the stack, then override the 'set the  
defaultFolder' so that the stack looks at the web server for external  
files, instead of in the relative file path as normally determined by  
the defaultFolder property.

I can't think of a simple way to do it.


Devin Asay
Humanities Technology and Research Support Center
Brigham Young University

More information about the Use-livecode mailing list