revlet and path

Sivakatirswami katir at hindu.org
Fri Aug 14 00:52:17 EDT 2009


Yves COPPE wrote:
> Hi list
>
> Here is a very simple script :
>
> on mouseUp
>     put empty into fld "resultat"
>    set itemDel to "/"
>    put item 1 to -2 of the effective fileName of this stack into tPath
>    set itemDel to comma
>    put tPath into fld "resultat"
> end mouseUp
>
> In the IDE, it gives the right path
> when I build a revlet, put it on my server and open it with Safari, it 
> gives ... nothing ! fld "resultat" stays empty
>
> Any idea ?
I believe this is to be expected. Since the file has not been saved to 
disk then it is effectively in RAM.  If you clone a stack and have not 
saved it yet, or download a stack from the RevOnline, and query them for 
their filename, I think you also get an empty filename.

But, it brings up an interesting feature request. It would be be great 
if the revlet were self-aware of it's source location... i.e the 
revlet's file name becomes  a global property containing it's URL. 
RevWebPlayer should be able to get this from

http://myDomain.org/edu/english-studies/Learn-English.revlet

of course you will not be able to set a the default folder from this or 
anything like that, but it could be useful to use item 1 to -2 to use as 
a tRootURL for getting other modules on the fly:

open stack url (tRootURL & "/" & "verbs/LearnVerbs.rev")
        # is that is even doable with the revWebPlayer? I suspect not....

but

put image (url (tRootURL & "/" & "images/whale.jpg") ) into image 1 ... 
should work...

And, if you were not trying to protect the directory contents and had 
the .htaccess set to "options +indices" in the source then you *could* 
effectively "get the files" which might be useful. this way your 
framework is portable otherwise one has to hardwire such url's into a 
global or custom prop and then if you move it to another server or 
another location on the same server, it breaks unless you update

A revlet may not know "Where am I" but it would  be nice if she knew 
"Where am I from?"









More information about the use-livecode mailing list