Trouble with 'there is a'

Ken Ray kray at sonsothunder.com
Fri Jan 27 13:31:12 EST 2012


On Jan 27, 2012, at 11:56 AM, Klaus on-rev wrote:

> Hi Pete,
> 
> Am 27.01.2012 um 18:35 schrieb Pete:
> 
>> Hi Ken,
>> You're saving my life on these Mac/Windows issues, thank you!  One question
>> on this.  What do the ask/answer file/folder dialogs return on Windows?
>> Does LC convert the "\" chars to "/" before putting it into the it variable,
> 
> Yes!
> 
>> or just pass whatever the os returns?
> 
> No!
> 
> :-)
> 
> Internally LiveCode always uses the UNIX slash / as the pathdelimiter.

Right - LC tries its hardest to keep things internally compatible and automatically translates "foreign" things like line breaks and path delimiters to its own internal format, and then retranslates it back when LC reaches out to the host operating system. So if you do an "answer file" on Windows and then get the path to the selected file, it's "/"-delimited, not "\"-delimited. If you then have to write data out to a file on Windows, and you do something like:

  put "Hello" into url ("file:C:/Users/kray/Desktop/Hello.txt")

it will work because LC recognizes it's on Windows and translates that to "C:\Users\kray\Desktop\Hello.txt" to communicate with the OS.

So the only times we need to deal with path delimiters is when (a) working with the WIndows registry (see queryRegistry/setRegistry/etc.), and (b) when handing off paths to external applications (like VBScript or AppleScript), IIRC.

> 

Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/	




More information about the use-livecode mailing list