SpecialFolder questions - Mobile and Desktop

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
DirkArnold
Posts: 15
Joined: Sat May 14, 2011 11:35 pm

SpecialFolder questions - Mobile and Desktop

Post by DirkArnold » Mon Sep 19, 2016 4:53 am

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

DirkArnold
Posts: 15
Joined: Sat May 14, 2011 11:35 pm

Re: SpecialFolder questions - Mobile and Desktop

Post by DirkArnold » Mon Sep 19, 2016 7:22 am

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.

MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Re: SpecialFolder questions - Mobile and Desktop

Post by MaxV » Mon Sep 19, 2016 11:21 am

Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

DirkArnold
Posts: 15
Joined: Sat May 14, 2011 11:35 pm

Re: SpecialFolder questions - Mobile and Desktop

Post by DirkArnold » Tue Sep 20, 2016 2:31 am

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.

MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Re: SpecialFolder questions - Mobile and Desktop

Post by MaxV » Tue Sep 20, 2016 9:33 am

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.
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

DirkArnold
Posts: 15
Joined: Sat May 14, 2011 11:35 pm

Re: SpecialFolder questions - Mobile and Desktop

Post by DirkArnold » Sat Sep 24, 2016 7:00 am

Well, that's much easier and somehow less scary. Thanks again, MaxV!

Post Reply