Page 1 of 1

new "documents" path works on simulator, not on device

Posted: Tue Feb 21, 2012 12:57 pm
by grovecat
I find that using just "documents" rather than SpecialFolderPath("documents"), as introduced in LiveCode 5.0.2, works with no problems in the simulator but not on the iPad. Can be shown in the following bits of code:

button Store
on mouseUp
set the defaultfolder to "documents"
if there is no folder "myData" then
create folder "myData"
end if
if there is no folder "myData/subFolder" then
create folder "myData/subFolder"
end if
put field "dataInput" into url("file:myData/subFolder/store.txt")
end mouseUp

button Retrieve
on mouseUp
set the defaultFolder to "documents"
put url("file:myData/subFolder/store.txt") into field "dataOutput"
end mouseUp

On the simulator it all happens as expected. On the iPad nothing happens. When I set file sharing on in the app, iTunes shows that the folders are not created with the "documents" version, but they are created with the SpecialFolderPath("documents") version.

It's not a big deal as I can continue using the old method, but it seems that something is going wrong.

Has anyone else come across this?

Cheers
Don

Re: new "documents" path works on simulator, not on device

Posted: Tue Feb 21, 2012 1:32 pm
by Klaus
Hi Don,

why use an "inofficial" syntax and tempt fate? :D
Maybe this works for you (sometimes) but don't rely on it!


Best

Klaus

Re: new "documents" path works on simulator, not on device

Posted: Tue Feb 21, 2012 2:08 pm
by grovecat
Hi Klaus

The new folder equivalents are documented on page 11 of the 5.0.2 Release Notes. It says nothing about them being unofficial so why would you not expect to confidently use them?

Cheers
Don

Re: new "documents" path works on simulator, not on device

Posted: Tue Feb 21, 2012 2:32 pm
by bn
Hi Don,

it says

documents folder

not "documents", especially not enclosed in quotes which makes it a literal.

try this in a button and a card with one field

Code: Select all

on mouseUp
   put the defaultFolder into tOldDefault
   put the defaultFolder into field 1
   set the defaultFolder to "documents" -- does not work
   put the defaultFolder into line 2 of field 1
   set the defaultFolder to  the documents folder
   put the defaultFolder into line 3 of field 1
   set the defaultFolder to tOldDefault
end mouseUp
actually I had not read that part of the Release Notes. It is a lot easier. Thank you.

Kind regards

Bernd

Re: new "documents" path works on simulator, not on device

Posted: Tue Feb 21, 2012 2:44 pm
by grovecat
Thanks Klaus

But I don't understand how my wrong code does actually work on the simulator. Anyway, all is well.

Cheers
Don

Re: new "documents" path works on simulator, not on device

Posted: Tue Feb 21, 2012 2:48 pm
by Klaus
Hi Don,

my pleasure, but that was Bernd!
I know that we germans all look alike to you aussies... :D


Best

Klaus

Re: new "documents" path works on simulator, not on device

Posted: Tue Feb 21, 2012 6:51 pm
by jacque
The simulator and a device work differently because they use different folder constructs. On the simulator, a real path to a real folder on your hard drive is used. On a device, the folders are "virtual" -- they don't really exist. The engine does some fancy translations so that your scripts act as though a folder was there, but really they aren't.

Re: new "documents" path works on simulator, not on device

Posted: Wed Feb 22, 2012 3:55 am
by grovecat
Sorry Bernd

I didn't read the signature on your post. Actually, even as an Aussie I can distinguish among Germans because I have a German son-in-law and a German daughter-in-law and we spent a month in your country last year. We really enjoyed it. :D

Cheers
Don

Re: new "documents" path works on simulator, not on device

Posted: Wed Feb 22, 2012 9:57 am
by bn
Hi Don,

no problem.

A couple of years ago I went to Melbourne and really liked it there. Though 22 hours on the plane were long...

Kind regards

Bernd