Added info:
I’ve tried putting the files in “cache”, in the “Documents” folder directly,
and using
> put URL ("file:"&tFile)
to store the data. Didn’t change anything.
I also looked at the lesson on reading and writing livecode files. Nothing
helps.
I’m using Livecode Business 9.6.0 on a Mac running 10.15.5
This is the last hurdle I have before am finished with this project. Any
suggestions would be mucho appreciated.
Best,
Bill
William A. Prothero
Santa Barbara, CA. 93105
http://earthlearningsolutions.org/
> On Jun 24, 2020, at 5:35 PM, prothero--- via use-livecode
> <[email protected]> wrote:
>
> Folks:
> I’m having a very weird problem writing then reading the same file on ios. I
> must be missing something very basic. I’ve checked the path to the file when
> it is written and it matches exactly to the path when I try to read it. In
> the read routine, I check for the file’s existence and it says it doesn’t.
> But when I write the file and immediately check for the file’s existence (in
> the same handler), it says it exists. I’ve checked the path with the debugger
> and the path it writes to is exactly the same as the path it looks for the
> file in.
>
> I must be missing something very basic. It works on my dev system, but in the
> phone, it can’t find the files it just wrote. Is there some kind of
> permission needed? I’m stumped.
>
> Please enlighten me. There must be some really, really basic thing I’m
> missing.
>
> Thanks,
> Bill
>
> --retrieves an arbitrary array from the waterdetective local storage folder
>
> function getArrayFromLocal fName
>
> put getPathToUserDocuments() into tFloc
>
> put tFloc&"/"&"waterdetective/"&fName into tFile
>
> if the last char of tFile is cr then
>
> delete the last char of tFile
>
> end if
>
> —It can’t find the file I just wrote
> if there is a file tFile then
>
> put URL ("binfile:"&tFile) into temp
>
> put base64decode(temp) into temp
>
> put arrayDecode(temp) into tArray
>
> else
>
> return ""
>
> end if
>
> return tArray
>
> end getArrayFromLocal
>
>
> function getPathToUserDocuments
>
> put specialFolderPath("Documents") into tPath
>
> return tPath
>
> end getPathToUserDocuments
>
> on saveArrayToLocal fName,tArray
>
> if fname contains "meterReadingsA" then
>
> breakpoint
>
> end if
>
> --put tNameExt after fName
>
> if the last char of fName is cr then
>
> delete the last char of fName
>
> end if
>
> put getPathToUserDocuments() into tFloc
>
> put tFloc&"/"&"waterdetective" into tFolder
>
> checkCreateFolder tFolder
>
> put tFolder&"/"&fName into tDataFile
>
> delete file tDataFile
>
> put arrayEncode(tArray) into temp
>
> put base64encode(temp) into tData
>
> put tData into URL ("binfile:"&tDataFile)
>
> wait 2 seconds
>
> if there is a file tDataFile then
>
> put "Yes" into x —on ios I get “Yes"
>
> put tDataFile into theLocalPath
>
> else
>
> put "No" into x
>
> end if
>
> end saveArrayToLocal
>
> William A. Prothero
> Santa Barbara, CA. 93105
> http://earthlearningsolutions.org/
>
> _______________________________________________
> use-livecode mailing list
> [email protected]
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode