URL 'file:' format

Klaus Major klaus at major-k.de
Thu Mar 23 07:48:11 EST 2006

Hi Graham,

> 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...

just tested here on my PC and this works (here).
NO slash after "file:", at least on windows!:

put "file:C:/YourFirstDirectory/YourSecondDirectory/Mine not your  
doc.text" into someFileDesignation
put url someFileDesignation into fld 1
## changed some text and then:
put fld 1 into url someFileDesignation

No problems...

You HAVE write permission there, do you? ;-)

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


Klaus Major
klaus at major-k.de

More information about the Use-livecode mailing list