What the heck? Writing and reading ios files??

JB sundown at pacifier.com
Thu Jun 25 17:23:43 EDT 2020

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.


> On Jun 25, 2020, at 1:53 PM, Terry Judd via use-livecode <use-livecode at lists.runrev.com> wrote:
> On 26/06/2020, 02:40, "use-livecode on behalf of William Prothero via use-livecode" <use-livecode-bounces at lists.runrev.com on behalf of use-livecode at 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 at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

More information about the use-livecode mailing list