Livecode Special Folder - Backwards Slashes?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
stoavio
Posts: 43
Joined: Sun Jun 30, 2013 2:09 am

Livecode Special Folder - Backwards Slashes?

Post by stoavio » Fri Oct 31, 2014 12:24 pm

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?

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Livecode Special Folder - Backwards Slashes?

Post by Klaus » Fri Oct 31, 2014 12:34 pm

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

stoavio
Posts: 43
Joined: Sun Jun 30, 2013 2:09 am

Re: Livecode Special Folder - Backwards Slashes?

Post by stoavio » Sat Nov 01, 2014 1:45 am

Thank you Klaus! I will continue using backslashes in my paths with this knowledge. :D

Post Reply