Page 1 of 1

SpecialFolder questions - Mobile and Desktop

Posted: Mon Sep 19, 2016 4:53 am
by DirkArnold
Hello. Intermittent user here, trying to get the hang of it again after a while.

I'm re-using parts of an earlier desktop app and hoping to deploy the new app to both desktop and mobile (iOS and Android). I have a bunch of external graphics and audio files in a Media folder from which my original standalone used to grab the files. Now I'm trying to build them into the package. I've been reading a bunch about the SpecialFolderPath but I can use a little more guidance.

My code now uses

Code: Select all

specialFolderPath("resources") & "/media/images/" & SomeFileNameVariable 
to find its images (and something very similar to find its audio). I also open and read some text files that are in the media folder that specify which files go where.

Everything works fine in the IDE, and in the xCode simulator. When I install the iOS standalone on my actual phone, however, none of the linked audio or graphics show up. The embedded graphics are there, and the logic that isn't dependent on the text files works.

I added media/* on the Copy Files tab of standalone settings. After building for iOS, when I "View Package Contents" on my development Mac I can see the media folder, the text files, images and audio subfolders, and their contents all where I'd expect.

I suspect I'm missing something simple, but I'll be darned if I can figure out what it is. Anyone have any suggestions?

Thanks! --Dirk

Re: SpecialFolder questions - Mobile and Desktop

Posted: Mon Sep 19, 2016 7:22 am
by DirkArnold
PS: Just for kicks I added answer specialFolderPath("resources") to the script, and on the phone it says:
/var/containers/Bundle/Application/<bunchanumbers>/appname.app
which doesn't seem useful for appending subdirectories.

Re: SpecialFolder questions - Mobile and Desktop

Posted: Mon Sep 19, 2016 11:21 am
by MaxV

Re: SpecialFolder questions - Mobile and Desktop

Posted: Tue Sep 20, 2016 2:31 am
by DirkArnold
Thanks, MaxV. Those pages explained things a little more clearly than what I had found, and I'm sure will also be helpful when it comes to trying to write files instead of just read them.

Speaking of which, I figured out the simple thing I was missing: As I mentioned, I read some data from text files. Once I was convinced that the path was correct, I added "for read" to my open file statements, and that did the trick. Precision pays, I suppose.

Re: SpecialFolder questions - Mobile and Desktop

Posted: Tue Sep 20, 2016 9:33 am
by MaxV
I feel much better with:

Code: Select all

put URL "file:/myPath/myFile.txt" into myVar
put URL "binfile:/myPath/myFile.jpg" into myVar2
put myVar3 into URL "binfile:/myPath/myFile.wav" 
You don't need to open and close files.

Re: SpecialFolder questions - Mobile and Desktop

Posted: Sat Sep 24, 2016 7:00 am
by DirkArnold
Well, that's much easier and somehow less scary. Thanks again, MaxV!