URL 'file:' format

Graham Samuel livfoss at mac.com
Thu Mar 23 07:22:47 EST 2006


It seems it's dumb question week for me - many of you will wonder how  
I've gone on with RR development for years and not known the answer  
to this one... anyway:

I only work with local text files in my current app, and I've never  
had to use the 'URL' form. However I think it would be convenient to  
do an update of a file using this form, since I want to be able to  
read the contents of a file and then replace the entire contents. The  
'open for update' and 'write to file' commands don't seem to to make  
this very convenient, but of course I may be misreading the docs...  
so I decide to use the form:

  get URL someFileDesignation

... do stuff to 'it'...

put it into URL someFileDesignation

which seems from the docs to be an OK thing to do.

Anyway I tried to create 'someFileDesignation' as

  "file:/C:/MyFirstDirectory/MySecondDirectory/Mydoc.text"

where everything after the "file:/" is a known valid file path (it's  
Windows XP, but of course RR internal format) and this can be proved  
by opening the file in text editor. I've tried putting 0, 1 and 2 '/'  
characters after "file:" but I always get "can't open file". The docs  
are not explicit on this point, and I've run out of guesses. What is  
the format supposed to be? And should I open the file first (I assume  
not, as this isn't mentioned in the docs).

Sorry if everyone else knows the answer, but there it is...

Graham

----------------------------------------
Graham Samuel / The Living Fossil Co. / UK and France




More information about the use-livecode mailing list