"/" or "\" - LiveCode is inconsistent

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
PoLyGLoT
Posts: 105
Joined: Sat Jan 14, 2012 12:37 am

"/" or "\" - LiveCode is inconsistent

Post by PoLyGLoT » Wed Oct 25, 2017 2:55 pm

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?

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 818
Joined: Fri Feb 06, 2015 4:03 pm

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

Post by LiveCode_Panos » Wed Oct 25, 2017 3:28 pm

Which version of LiveCode are you using?

PoLyGLoT
Posts: 105
Joined: Sat Jan 14, 2012 12:37 am

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

Post by PoLyGLoT » Wed Oct 25, 2017 3:33 pm

Community Edition 8.0.2 | Build 13025

PoLyGLoT
Posts: 105
Joined: Sat Jan 14, 2012 12:37 am

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

Post by PoLyGLoT » Wed Oct 25, 2017 7:00 pm

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.

Klaus
Posts: 13824
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

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

Post by Klaus » Wed Oct 25, 2017 7:04 pm

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"]?

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9823
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

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

Post by FourthWorld » Wed Oct 25, 2017 7:30 pm

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.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 818
Joined: Fri Feb 06, 2015 4:03 pm

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

Post by LiveCode_Panos » Wed Oct 25, 2017 8:31 pm

Ok, yes this is a bug, which is fixed in 8.1.7 rc-1:

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

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”