Re: What the heck? Writing and reading ios files??
Ralph DiMola wrote: > I did not know that. I thought all DNS was case insensitive not just > the TLD. I never seen it to the contrary. > > The Unicode thing is scary though. It validates my surfing habits. I > never use email links. If I get an email from say my bank I always > type the URL into a browser or a verified bookmark to check it out. Good habit. For extra protection this browser extension (Firefox, Chrome, Opera) will warn and block when you attempt to visit a Unicode domain: https://aykutcevik.com/blog/idn-safe-now-available-for-nearly-all-browsers/ -- Richard Gaskin Fourth World Systems Software Design and Development for the Desktop, Mobile, and the Web ambassa...@fourthworld.comhttp://www.FourthWorld.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
RE: What the heck? Writing and reading ios files??
I did not know that. I thought all DNS was case insensitive not just the TLD. I never seen it to the contrary. The Unicode thing is scary though. It validates my surfing habits. I never use email links. If I get an email from say my bank I always type the URL into a browser or a verified bookmark to check it out. Live and learn, thanks. Ralph DiMola IT Director Evergreen Information Services rdim...@evergreeninfo.net -Original Message- From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On Behalf Of Mark Wieder via use-livecode Sent: Thursday, June 25, 2020 6:36 PM To: Ralph DiMola via use-livecode Cc: Mark Wieder Subject: Re: What the heck? Writing and reading ios files?? On 6/25/20 2:16 PM, Ralph DiMola via use-livecode wrote: > FYI: So does Android. > > ...Imagine if we had case sensitive URLs or email addresses... Um. In that case, you'll probably be surprised to find out that URLs *are* case-sensitive. It's only the TLD where it doesn't matter. What *is* a problem is the use of unicode characters to simulate ASCII in URLs in order to redirect traffic to phishing sites. -- Mark Wieder ahsoftw...@gmail.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: What the heck? Writing and reading ios files??
Glad to see you got it working! JB > On Jun 25, 2020, at 3:25 PM, Prothero-ELS via use-livecode > wrote: > > JB, > Thanks for the comment. Yes, I went back to my previous use of “_” in the > file name. All is working now. It was the difference between “l” and “L” in a > file name. Sheesh! > Bill > > William Prothero > https://earthlearningsolutions.org > >> On Jun 25, 2020, at 2:27 PM, JB via use-livecode >> wrote: >> >> I don’t think the underscore character “_” should cause any problems >> in the pathname but if you use a space in the name you need to be >> sure and enclose the pathname in quotes or it will fail. >> >> JB >> >>> On Jun 25, 2020, at 1:53 PM, Terry Judd via use-livecode >>> wrote: >>> >>> On 26/06/2020, 02:40, "use-livecode on behalf of William Prothero via >>> use-livecode" >> use-livecode@lists.runrev.com> wrote: >>> >>> Jacqueline: >>> Thanks for responding. I am really stuck on this. >>> >>> I can write the file, and get a list of the files I write, but when I try >>> to read the file using the same code to create the filepaths, etc, the read >>> routine says the file doesn’t exist. It all works in the dev environment. I >>> had used a “_” char in the filenames, so I removed it. The read routine >>> can’t find the file. Very wierd. >>> >>> I’m going to try to make a very simple test case that I can run on my >>> phone and post it, but I’m going to take a break. I’ve posted my file >>> reading and writing code here, but there is probably too much to go >>> through. >>> >>> Thanks for responding, >>> Bill >>> >>> >>> Hi Bill - here's an example script that I use cross-platform (desktop, iOS >>> and Android) for reading and writing a settings file using >>> specialFoderPath("documents") on mobile and specialFolderPath("support") on >>> desktop. In this case the 'settings' are an array that are stored in a >>> multipurpose global array (gData). >>> >>> Terry... >>> >>> global gData >>> >>> on setPaths >>> switch environment() >>>case "mobile" >>> put specialFolderPath("documents")&"/" into tFolder >>> break >>>default >>> put specialFolderPath("support")&"/myAppName/" into tFolder >>> if not (there is a folder tFolder) then >>> create folder tFolder >>> end if >>> end switch >>> put tFolder&"settings.dat" into gData["paths"]["settings"] >>> end setPaths >>> >>> on loadSettings >>> put gData["paths"]["settings"] into tPath >>> put url ("binfile:"&tPath) into tSettings >>> if tSettings is not empty then >>>put arrayDecode(tSettings) into tSettingsA >>>if tSettingsA is an array then >>> put tSettingsA into gData["settings"] >>>else >>> # invalid settings data >>>end if >>> else >>># no settings file >>> end if >>> end loadSettings >>> >>> on updateSettings >>> put gData["paths"]["settings"] into tPath >>> put gData["settings"] into tSettings >>> put arrayEncode(tSettings) into tSettings >>> put tSettings into url ("binfile:"&tPath) >>> end updateSettings >>> >>> on clearSettings >>> put gData["paths"]["settings"] into tPath >>> if there is a file tPath then delete file tPath >>> end clearSettings >>> >>> ___ >>> use-livecode mailing list >>> use-livecode@lists.runrev.com >>> Please visit this url to subscribe, unsubscribe and manage your >>> subscription preferences: >>> http://lists.runrev.com/mailman/listinfo/use-livecode >> >> >> ___ >> use-livecode mailing list >> use-livecode@lists.runrev.com >> Please visit this url to subscribe, unsubscribe and manage your subscription >> preferences: >> http://lists.runrev.com/mailman/listinfo/use-livecode > > > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: What the heck? Writing and reading ios files??
On 6/25/20 2:16 PM, Ralph DiMola via use-livecode wrote: FYI: So does Android. ...Imagine if we had case sensitive URLs or email addresses... Um. In that case, you'll probably be surprised to find out that URLs *are* case-sensitive. It's only the TLD where it doesn't matter. What *is* a problem is the use of unicode characters to simulate ASCII in URLs in order to redirect traffic to phishing sites. -- Mark Wieder ahsoftw...@gmail.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: What the heck? Writing and reading ios files??
JB, Thanks for the comment. Yes, I went back to my previous use of “_” in the file name. All is working now. It was the difference between “l” and “L” in a file name. Sheesh! Bill William Prothero https://earthlearningsolutions.org > On Jun 25, 2020, at 2:27 PM, JB via use-livecode > wrote: > > I don’t think the underscore character “_” should cause any problems > in the pathname but if you use a space in the name you need to be > sure and enclose the pathname in quotes or it will fail. > > JB > >> On Jun 25, 2020, at 1:53 PM, Terry Judd via use-livecode >> wrote: >> >> On 26/06/2020, 02:40, "use-livecode on behalf of William Prothero via >> use-livecode" > use-livecode@lists.runrev.com> wrote: >> >> Jacqueline: >> Thanks for responding. I am really stuck on this. >> >> I can write the file, and get a list of the files I write, but when I try >> to read the file using the same code to create the filepaths, etc, the read >> routine says the file doesn’t exist. It all works in the dev environment. I >> had used a “_” char in the filenames, so I removed it. The read routine >> can’t find the file. Very wierd. >> >> I’m going to try to make a very simple test case that I can run on my >> phone and post it, but I’m going to take a break. I’ve posted my file >> reading and writing code here, but there is probably too much to go through. >> >> Thanks for responding, >> Bill >> >> >> Hi Bill - here's an example script that I use cross-platform (desktop, iOS >> and Android) for reading and writing a settings file using >> specialFoderPath("documents") on mobile and specialFolderPath("support") on >> desktop. In this case the 'settings' are an array that are stored in a >> multipurpose global array (gData). >> >> Terry... >> >> global gData >> >> on setPaths >> switch environment() >> case "mobile" >>put specialFolderPath("documents")&"/" into tFolder >>break >> default >>put specialFolderPath("support")&"/myAppName/" into tFolder >>if not (there is a folder tFolder) then >> create folder tFolder >>end if >> end switch >> put tFolder&"settings.dat" into gData["paths"]["settings"] >> end setPaths >> >> on loadSettings >> put gData["paths"]["settings"] into tPath >> put url ("binfile:"&tPath) into tSettings >> if tSettings is not empty then >> put arrayDecode(tSettings) into tSettingsA >> if tSettingsA is an array then >>put tSettingsA into gData["settings"] >> else >># invalid settings data >> end if >> else >> # no settings file >> end if >> end loadSettings >> >> on updateSettings >> put gData["paths"]["settings"] into tPath >> put gData["settings"] into tSettings >> put arrayEncode(tSettings) into tSettings >> put tSettings into url ("binfile:"&tPath) >> end updateSettings >> >> on clearSettings >> put gData["paths"]["settings"] into tPath >> if there is a file tPath then delete file tPath >> end clearSettings >> >> ___ >> use-livecode mailing list >> use-livecode@lists.runrev.com >> Please visit this url to subscribe, unsubscribe and manage your subscription >> preferences: >> http://lists.runrev.com/mailman/listinfo/use-livecode > > > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: What the heck? Writing and reading ios files??
I don’t think the underscore character “_” should cause any problems in the pathname but if you use a space in the name you need to be sure and enclose the pathname in quotes or it will fail. JB > On Jun 25, 2020, at 1:53 PM, Terry Judd via use-livecode > wrote: > > On 26/06/2020, 02:40, "use-livecode on behalf of William Prothero via > use-livecode" use-livecode@lists.runrev.com> wrote: > >Jacqueline: >Thanks for responding. I am really stuck on this. > >I can write the file, and get a list of the files I write, but when I try > to read the file using the same code to create the filepaths, etc, the read > routine says the file doesn’t exist. It all works in the dev environment. I > had used a “_” char in the filenames, so I removed it. The read routine can’t > find the file. Very wierd. > >I’m going to try to make a very simple test case that I can run on my > phone and post it, but I’m going to take a break. I’ve posted my file reading > and writing code here, but there is probably too much to go through. > >Thanks for responding, >Bill > > > Hi Bill - here's an example script that I use cross-platform (desktop, iOS > and Android) for reading and writing a settings file using > specialFoderPath("documents") on mobile and specialFolderPath("support") on > desktop. In this case the 'settings' are an array that are stored in a > multipurpose global array (gData). > > Terry... > > global gData > > on setPaths > switch environment() > case "mobile" > put specialFolderPath("documents")&"/" into tFolder > break > default > put specialFolderPath("support")&"/myAppName/" into tFolder > if not (there is a folder tFolder) then >create folder tFolder > end if > end switch > put tFolder&"settings.dat" into gData["paths"]["settings"] > end setPaths > > on loadSettings > put gData["paths"]["settings"] into tPath > put url ("binfile:"&tPath) into tSettings > if tSettings is not empty then > put arrayDecode(tSettings) into tSettingsA > if tSettingsA is an array then > put tSettingsA into gData["settings"] > else > # invalid settings data > end if > else > # no settings file > end if > end loadSettings > > on updateSettings > put gData["paths"]["settings"] into tPath > put gData["settings"] into tSettings > put arrayEncode(tSettings) into tSettings > put tSettings into url ("binfile:"&tPath) > end updateSettings > > on clearSettings > put gData["paths"]["settings"] into tPath > if there is a file tPath then delete file tPath > end clearSettings > > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
RE: What the heck? Writing and reading ios files??
FYI: So does Android. I always get pushback when I say "case sensitivity in file names is a disaster waiting to happen". If doesn't waste a few days now it will later. The push back is either purest or that it saves cpu cycles. If your running Amazon's website then OK have a party with case sensitivity but in most cases it doesn't make much if any performance difference. Imagine if we had case sensitive URLs or email addresses. That would be a hackers dream. Ralph DiMola IT Director Evergreen Information Services rdim...@evergreeninfo.net -Original Message- From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On Behalf Of prothero--- via use-livecode Sent: Thursday, June 25, 2020 4:07 PM To: JJS via use-livecode Cc: proth...@earthlearningsolutions.org Subject: Re: What the heck? Writing and reading ios files?? Folks: Thanks for you input. What I found out is that the iPhone cares very much about case in text, but running the app on my desktop didn’t care about case, so I had a mystery solved only by going down every blind alley until I finally found the offending code. It also seems, but I haven’t tested this because I’m burned out after a day fighting with this, is that it seems the put URL statement likes to have its defaultFolder set and that it doesn’t like full pathnames. Not sure, but …… This is one thing that can be extremely frustrating when the IDE doesn’t match the requirements for the destination device. Seems maybe there could be warning that would appear in the help files especially about the case sensitivity of iOS filenames. BTW, specialFilePath(“Documents”) works on ios, as does specialFilePath(“documents”), at least on the versions I'm using. (iOS latest and latest Mac OS’s). Thanks for your responses, BIll William A. Prothero Santa Barbara, CA. 93105 http://earthlearningsolutions.org/ ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: What the heck? Writing and reading ios files??
On 26/06/2020, 02:40, "use-livecode on behalf of William Prothero via use-livecode" wrote: Jacqueline: Thanks for responding. I am really stuck on this. I can write the file, and get a list of the files I write, but when I try to read the file using the same code to create the filepaths, etc, the read routine says the file doesn’t exist. It all works in the dev environment. I had used a “_” char in the filenames, so I removed it. The read routine can’t find the file. Very wierd. I’m going to try to make a very simple test case that I can run on my phone and post it, but I’m going to take a break. I’ve posted my file reading and writing code here, but there is probably too much to go through. Thanks for responding, Bill Hi Bill - here's an example script that I use cross-platform (desktop, iOS and Android) for reading and writing a settings file using specialFoderPath("documents") on mobile and specialFolderPath("support") on desktop. In this case the 'settings' are an array that are stored in a multipurpose global array (gData). Terry... global gData on setPaths switch environment() case "mobile" put specialFolderPath("documents")&"/" into tFolder break default put specialFolderPath("support")&"/myAppName/" into tFolder if not (there is a folder tFolder) then create folder tFolder end if end switch put tFolder&"settings.dat" into gData["paths"]["settings"] end setPaths on loadSettings put gData["paths"]["settings"] into tPath put url ("binfile:"&tPath) into tSettings if tSettings is not empty then put arrayDecode(tSettings) into tSettingsA if tSettingsA is an array then put tSettingsA into gData["settings"] else # invalid settings data end if else # no settings file end if end loadSettings on updateSettings put gData["paths"]["settings"] into tPath put gData["settings"] into tSettings put arrayEncode(tSettings) into tSettings put tSettings into url ("binfile:"&tPath) end updateSettings on clearSettings put gData["paths"]["settings"] into tPath if there is a file tPath then delete file tPath end clearSettings ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: What the heck? Writing and reading ios files??
Folks: Thanks for you input. What I found out is that the iPhone cares very much about case in text, but running the app on my desktop didn’t care about case, so I had a mystery solved only by going down every blind alley until I finally found the offending code. It also seems, but I haven’t tested this because I’m burned out after a day fighting with this, is that it seems the put URL statement likes to have its defaultFolder set and that it doesn’t like full pathnames. Not sure, but …… This is one thing that can be extremely frustrating when the IDE doesn’t match the requirements for the destination device. Seems maybe there could be warning that would appear in the help files especially about the case sensitivity of iOS filenames. BTW, specialFilePath(“Documents”) works on ios, as does specialFilePath(“documents”), at least on the versions I'm using. (iOS latest and latest Mac OS’s). Thanks for your responses, BIll William A. Prothero Santa Barbara, CA. 93105 http://earthlearningsolutions.org/ ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: What the heck? Writing and reading ios files??
Jacqueline: Thanks for responding. I am really stuck on this. I can write the file, and get a list of the files I write, but when I try to read the file using the same code to create the filepaths, etc, the read routine says the file doesn’t exist. It all works in the dev environment. I had used a “_” char in the filenames, so I removed it. The read routine can’t find the file. Very wierd. I’m going to try to make a very simple test case that I can run on my phone and post it, but I’m going to take a break. I’ve posted my file reading and writing code here, but there is probably too much to go through. Thanks for responding, Bill --saves an arbitrary array to the waterdetective local storage folder --fname is the name of the db, tNameExt -"_Wkng" for added files, or "_Dwnld" for downloaded files. on saveArrayToLocal fName,tArray put fixUpFName(fName) into fName if fname contains "meterReadingsA" then --breakpoint end if if the last char of fName is cr then delete the last char of fName end if put getPathToUserDocuments() into tFloc put tFloc into tFolder --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) --put tData into URL ("file:"&tDataFile) wait 2 seconds --This is for testing with debug if there is a file tDataFile then put "Yes" into x put tDataFile into theLocalPath else put "No" into x end if end saveArrayToLocal on deleteLocalTempFiles tFileNameAddon put checkCreateLocalFolder() into tFolderPath put getTheLocalFiles() into tFiles repeat for each line tFile in tFiles put tFile&tFileNameAddon into theFileToDelete if not (char 1 of theFileToDelete is ".") then put tFolderPath&"/"&theFileToDelete into xFilePath delete file xFilePath end if end repeat end deleteLocalTempFiles function getTheLocalFiles put checkCreateLocalFolder() into tFolderPath set the defaultFolder to tFolderPath put files(tFolderPath) into tFiles return tFiles end getTheLocalFiles function isThereALocalFile fName put fixUpFName(fName) into fName put getPathToUserDocuments() into tFloc put tFloc&"/"&fName into tDataFile if there is a file tDataFile then return TRUE else return FALSE end if end isThereALocalFile function fixUpFName fName replace "_" with "xx" in fName return fName end fixUpFName --creates local folder and returns the folderPath function checkCreateLocalFolder tFolder put getPathToUserDocuments() into tFloc if tFolder = "" then return tFloc exit checkCreateLocalFolder end if put tFloc&"/"&tFolder into tFolderPath checkCreateFolder tFolderPath return tFolderPath end checkCreateLocalFolder --retrieves an arbitrary array from the waterdetective local storage folder function getArrayFromLocal fName put fixUpFName(fName) into fName if fname contains "meterReadingsA" then --breakpoint end if put getPathToUserDocuments() into tFloc put tFloc&"/"&fName into tFile put isThereALocalFile(fName) into isAFile if isAFile is TRUE then put URL ("binfile:"&tFile) into temp --put URL ("file:"&tFile) into temp put base64decode(temp) into temp put arrayDecode(temp) into tArray else return "Can't find file." end if return tArray end getArrayFromLocal on deleteLocalFile fName put fixUpFName(fName) into fName put getPathToUserDocuments() into tFloc put tFloc&"/"&"waterdetective/"&fName into tFile if there is a file tFile then delete file tFile end if end deleteLocalFile --tFolder is the complete path to the folder to be tested on checkCreateFolder tFolder if there is not a folder tFolder then create folder tFolder end if end checkCreateFolder function getPathToUserDocuments tFolder put specialFolderPath("documents") into tPath if the environment contains "development" then put tPath&"/waterdetective" into tPath end if if tFolder = "" then return tPath else put tPath&"/"&tFolder into tPath end if return tPath end getPathToUserDocuments William A. Prothero https://earthlearningsolutions.org > On Jun 24, 2020, at 9:22 PM, J. Landman Gay via use-livecode > wrote: > > Mobile is case-sensitive, desktop isn't. The "documents" folder should be all > lower case. > > If that's not the problem then show us the lines of script that both create > the file path and retrieve it. > > -- > Jacqueline Landman Gay | jac...@hyperactivesw.com > HyperActive Software | http://www.hyperactivesw.com > On June 24, 2020 10:06:45 PM prothero--- via use-livecode > wrote: > >> Added info: >> I’ve tried putting the files in “cache”, in the “Documents” folder directly, >> and using >>> put URL ("file:
Re: What the heck? Writing and reading ios files??
Hi Bill, > Am 25.06.2020 um 02:35 schrieb prothero--- via use-livecode > : > > 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 getPathToUserDocuments ## Use lowercase -> documents! > put specialFolderPath("documents") into tPath > ... > William A. Prothero > Santa Barbara, CA. 93105 > http://earthlearningsolutions.org/ Best Klaus -- Klaus Major https://www.major-k.de kl...@major-k.de ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: What the heck? Writing and reading ios files??
Mobile is case-sensitive, desktop isn't. The "documents" folder should be all lower case. If that's not the problem then show us the lines of script that both create the file path and retrieve it. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com On June 24, 2020 10:06:45 PM prothero--- via use-livecode wrote: 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 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 use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: What the heck? Writing and reading ios files??
Another solution might be to copy and paste a file or create a new file of any type and give it a name like myPath or whatever. Put that file in the same location of the directory you expect your other file to show up in. You can use any method to get the file path of your new file myPath and use the info to validate the path you are providing for the file you have been trying to create but cannot find. There might be some hidden character etc that is preventing the file showing up or even something like a dot before the name making it invisible on a mac. JB > On Jun 24, 2020, at 8:04 PM, prothero--- via use-livecode > wrote: > > 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 >> 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 >> use-livecode@lists.runrev.com >> Please visit this url to subscribe, unsubscribe and manage your subscription >> preferences: >> http://lists.runrev.com/mailman/listinfo/use-livecode > > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: What the heck? Writing and reading ios files??
I didn’t test the code so I do not know what is happening with the file. But and idea to test for problems is only write code that will put something like :Hello world!” into the file and see if you can locate the file on your drive. If you still have the problem at least it can be fixed within that few lines of code or it might be a bug of some sort. JB > On Jun 24, 2020, at 8:04 PM, prothero--- via use-livecode > wrote: > > 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 >> 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 >> use-livecode@lists.runrev.com >> Please visit this url to subscribe, unsubscribe and manage your subscription >> preferences: >> http://lists.runrev.com/mailman/listinfo/use-livecode > > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: What the heck? Writing and reading ios files??
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 > 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 > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode