I have an issue that I'm pretty sure is caused by an external file not being loaded when I save as a Standalone Application.
I have a text file located on my MacBook Air running Mac OS 10.14.5 in the Documents folder.
In the Copy Files box in the Standalone Settings, I select this file to be copied in the build.
Everything works swimmingly on the mac but when I load it onto my iPhone 8+ iOS 12.3.2 the text file is either not accessible or not there.
I put a statement in the file to show the number of lines in the file:
set the defaultFolder to (specialFolderPath("documents") & slash)
put URL("file:" & (specialFolderPath(documents") & "/Script.txt")) into tfile
Put the number of lines of tfile into howmany
answer howmany
On the Mac I get the answer 366
On the iPhone the answer is 0
I think this is the first app I have written that needed a file that I needed to copy when building the app.
Is something wrong with the way I am copying the file to the iPhone?
Thanks
Tom
Copy Files in Standalone settings
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Copy Files in Standalone settings
When you add files in the standalone builder, they will be bundled on the mobile device in the specialFolderPath ("resources") location. This is not a writeable location. If you need to save edits to the text file, you must copy it to the specialFolderPath ("documents") folder. (First check if it has previously been copied, or it will be overwritten with the same version that got bundled with the standalone. )
specialFolderPath ("documents") is a sandboxed folder accessible and writeable by your app, but not visible to other apps without root.
There is also specialFolderPath("external documents") if you need to make a file globally accessible.
Note the path is case sensitive and should be a lower case D.
specialFolderPath ("documents") is a sandboxed folder accessible and writeable by your app, but not visible to other apps without root.
There is also specialFolderPath("external documents") if you need to make a file globally accessible.
Note the path is case sensitive and should be a lower case D.
Re: Copy Files in Standalone settings
Thank You!
All is well
All is well

Re: Copy Files in Standalone settings
And no need to "set the defaultfolder" if you provide an ABSOLUTE path:
Code: Select all
...
## set the defaultFolder to (specialFolderPath("documents") & slash)
put URL("file:" & (specialFolderPath(documents") & "/Script.txt")) into tfile
...