Page 1 of 1

"/" or "\" - LiveCode is inconsistent

Posted: Wed Oct 25, 2017 2:55 pm
by PoLyGLoT
Hi all,

I've noticed that if I grab a directory of a file using code like this:

Code: Select all

on dragDrop
repeat for each line theLine in the dragData["files"]
      put URL ("file:" & theLine) into theFilePath
end repeat
end dragDrop
It returns something like this:

Code: Select all

C:\Users\ID\Desktop\Folder Here\File Here
However, if I use this code:

Code: Select all

  set the defaultFolder to specialFolderPath("Desktop")
  put defaultFolder & "\" & "New Folder Here" into NewPathHere
I get something like this:

Code: Select all

C:/Users/ID/Desktop\New Folder Here
This is a problem. It seems like LiveCode is reading natural data paths with a "\" but then if you set a defaultFolder to the desktop, it creates the path with a "/".

Why are the slashes inconsistent? Is this a bug?

Re: "/" or "\" - LiveCode is inconsistent

Posted: Wed Oct 25, 2017 3:28 pm
by LiveCode_Panos
Which version of LiveCode are you using?

Re: "/" or "\" - LiveCode is inconsistent

Posted: Wed Oct 25, 2017 3:33 pm
by PoLyGLoT
Community Edition 8.0.2 | Build 13025

Re: "/" or "\" - LiveCode is inconsistent

Posted: Wed Oct 25, 2017 7:00 pm
by PoLyGLoT
Just curious - is this a bug or just me experiencing this? I could use a workaround to avoid the issue, but if updating will resolve it I might do that, too.

Re: "/" or "\" - LiveCode is inconsistent

Posted: Wed Oct 25, 2017 7:04 pm
by Klaus
LC ALWAYS uses the SLASH / as a pathdelimiter internally! (Its root is UNIX! :D )
Maybe this is just a "glitch" on Windows with dragdata["files"]?

Re: "/" or "\" - LiveCode is inconsistent

Posted: Wed Oct 25, 2017 7:30 pm
by FourthWorld
When I get the dragData["files"] in LiveCode 9.0dp9 on Windows 10 I get "/" as the path delimiter. This is consistent with path values I've seen from "ask folder", "ask file", "answer folder", "answer file", and pretty much everything else that handles paths in LC since I started using it in 1997.

Thanks for posting your LC version. It may also be helpful to know which version of Windows you're running.

Version 8.0.2 is several versions old. It may be helpful to try a more recent version to see if the problem is reproducible with the current code base. If it is we'll have to figure out why this is happening on your system but not others.

Re: "/" or "\" - LiveCode is inconsistent

Posted: Wed Oct 25, 2017 8:31 pm
by LiveCode_Panos
Ok, yes this is a bug, which is fixed in 8.1.7 rc-1:

https://github.com/livecode/livecode/pull/5772