Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

iOS and MacOS / setCurrentDir() problem

Author
Message
Kevin Cross
18
Years of Service
User Offline
Joined: 15th Nov 2003
Location: London, UK
Posted: 4th May 2012 19:27
Hi

I can move around diretories fine when running my app through the AppGameKit player but as soon as I convert my T1 program to an iPhone app via XCode and run it seems to be all off path and I can't find the correct way to write the setCurrentDir command.

Here's my folder structure:

media
media/images/
media/images/decks/
media/images/decks/deck01

Originally I scripted it so that the decks folder was on level with images but I've been moving it about to try and find a way to access it and then get back to the media folder.

Here's my code which works when running it via the compiler in Windows. Can someone please let me know where I'm going wrong? I basically want to loop through the files in the decks folder to find some text files with extension .scd, preload the images in the folder and then go back to the media folder so that all of the standard defualt images load.

When I run it on the iPhone as an installed app it doesn't seem to pay any attention to the SetCurrentDir() command



To get this to work via the compiler I've had to setCurrentDir as blank before setting it as media. Setting it as either on its own doesn't work.

On the iPhone it's not going into the images/decks folder and looping through the files.

I would still prefer to have the decks folder on level with the images folder but at the moment I'd settle for whatever works.

the12thplaya
Ancient Lady
Valued Member
18
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 4th May 2012 20:55
Since the iOS stuff does not put the resources in a directory called 'media', all you need to do is add the 'setCurrentDir("")' before your call to 'setCurrentDir("images/decks")'.

You should add some code to determine if you are in Windows or not before you execute the command 'setCurrentDir("media")'. All the other platforms use a different location and you never actually reference it directly.

Cheers,
Ancient Lady
bjadams
AGK Backer
14
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 5th May 2012 00:45
There are no directory structures in iOS. all your media is in the root directory of the app.
Ancient Lady
Valued Member
18
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 5th May 2012 01:34
I ran a test that used a subdirectory in both Windows and iOS (built in Xcode4) and it worked fine as long.

In Windows, the subdir was directly under the project.

In Xcode, I added the entire subdir to the resources, cleaned, rebuilt and ran it on my iOS devices.

My test subdir was NOT under the media directory.

Cheers,
Ancient Lady
bjadams
AGK Backer
14
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 5th May 2012 11:40
the MEDIA dir has long been depreciated
Kevin Cross
18
Years of Service
User Offline
Joined: 15th Nov 2003
Location: London, UK
Posted: 5th May 2012 11:59
Thanks for all of your replies and help. I'll try what you suggested a little later today Ancient Lady

the12thplaya
Kevin Cross
18
Years of Service
User Offline
Joined: 15th Nov 2003
Location: London, UK
Posted: 5th May 2012 13:57 Edited at: 5th May 2012 15:30
I still had a bit of trouble with this but have finally cracked it. I think it was partly due to how I loaded the folders into the Resources folder in XCode.

This is the final code which is working on Windows and the iPhone



I know the code will always load the last .scd file it finds in the folder but I'm not worrying about that at the moment.

When loading the folders into the Resources folder into XCode I had to choose "Create folder references for any added folders" and not "Create groups for any added folders"

Once again thanks for your help

the12thplaya

Login to post a reply

Server time is: 2022-09-29 13:32:19
Your offset time is: 2022-09-29 13:32:19