Page 1 of 1

Livecode Special Folder - Backwards Slashes?

Posted: Fri Oct 31, 2014 12:24 pm
by stoavio
I am not sure if this is a glitch in LC7 or if it really even matters, but when I am using the defaultfolder to get the path of my app's directory, I notice the slashes it returns are forward slashes instead of back slashes.

get the defaultfolder
answer it

shows me this:

Image

*note: I added that last trailing slash using & "\" which is what made me notice the difference in direction to begin with.

and my windows explorer shows me this:

Image


Any idea why LC is flipping the slashes, and ultimately, will it matter or can either slash be used interchangeably in paths?

Re: Livecode Special Folder - Backwards Slashes?

Posted: Fri Oct 31, 2014 12:34 pm
by Klaus
HI stoavio,

this is correct behaviour! :D

Internally Livecode ALWAYS uses the UNIX path delimiter and that is a SLASH!
LC will translate this to the correct form on the appropriate platform, don't worry :D

You only need to supply the platform specific path delimiters when you use SHELL commands,
means the BACKSLASH on Windows!

So you should also use SLASH inside of Livecode, even if you are on Windwos:
...
put specialfolderpath("desktop") & "/a_folder/a_file.txt" into tTextFile
...


Best

Klaus

Re: Livecode Special Folder - Backwards Slashes?

Posted: Sat Nov 01, 2014 1:45 am
by stoavio
Thank you Klaus! I will continue using backslashes in my paths with this knowledge. :D