Page 1 of 1

URL on a PC bug?

Posted: Fri Jan 15, 2016 5:57 pm
by lohill
I have come across what appears to be a bug using "URL" on a PC and I would like confirmation that what I am seeing is what others see. If it really is a bug rather than my problem then it should be reported immediately because it is definitely a game breaker. The code below is an example of how to create the error:

Code: Select all

on mouseUp
   answer file "Locate a text file for opening." with "OK" or "Cancel"
   if It = "Cancel" then exit mouseUp
   put "file:/" & it into tFile
   put URL tFile into tData
   answer tData
end mouseUp
On a Mac in LC 7.1.1 it runs just fine, both in the IDE and in a standalone. On a PC in either environment, the statement "put URL tFile into tData" fails and nothing is put in tData. There are no error messages just nothing in the "answer dialog".

I have only been able to test it on the PC side in two different Parallels virtual machines, one in Windows 7 and one in Windows 10. Am I making any errors here or is this a real problem?

Larry

Re: URL on a PC bug?

Posted: Fri Jan 15, 2016 6:08 pm
by FourthWorld
With many commands in LiveCode it's useful to check "the result" immediately after the command should anything go wrong. Any file I/O operations are good candidates, even better when accompanied by a call to sysError so the OS can tell you more specifically what's going on, e.g.:

Code: Select all

   put URL tFile into tData
   if the result is not empty then
       answer the result &"("& sysError() &")"
       exit to top
   end if
   answer tData

Re: URL on a PC bug?

Posted: Fri Jan 15, 2016 6:32 pm
by Klaus
Hi lohill,

remove the SLASH and try again:
...
if It = "Cancel" then exit mouseUp
## put "file:/" & it into tFile
put "file:" & it into tFile
put URL tFile into tData
answer tData
...
You can also have it much shorter:
...
if It = "Cancel" then exit mouseUp
answer url("file:" & it)
...
:D


Best

Klaus

Re: URL on a PC bug?

Posted: Fri Jan 15, 2016 6:45 pm
by lohill
Thanks guys. What a relief.

Larry