Game Development Community

iOS user directory

by Matthew Wilmot · in iTorque 2D · 10/19/2011 (1:20 pm) · 1 replies

I've tried to find information on saving to the iOS user directory but I keep finding very old forum posts.

My current system will run find on windows and will save to the application directory but when I build on iPad it gets up to the point where the file containing all my saving code is exec'd it brings up the error:

Missing file: /private/var/mobile/Applications/21DCEC08-09F7-446D-B216-B4778A35F8BB/iTorque2DGame.app/scripts/information/ProfileSystem.cs!

I'm guessing that's because the file wasn't compiling for iOS even though it's fine on windows.

The system uses the save() function to store data about the game then reload at a later date.

This is part of my original code:

$ProfileDirectory = "Profiles/";

function MakeProfile(%profileName)
{
   // Make the object
   %newProfile = new ScriptObject()
   {
      class = "Profile";
      profileName = %profileName; // The name of the profile
   };

   // Add default game data
   %newProfile.GameState = new ScriptObject( : GameStateProfile );
   
 
   // Save the profile
   %newProfile.saveProfile();
}

function Profile::saveProfile(%this)
{
   // The reason we create a new ProfileObject here
   // is so that we can potentially have multiple profiles
   // the ProfileObject as its name so we fix that here

   // Make a new profile object
   %saveObject = new ScriptObject(ProfileObject)
   {
      class = "Profile";
      profileName = %this.profileName;
   };
   
   %saveObject.save($ProfileDirectory @ %this.profileName @ ".tmp");
   ProfileObject.delete(); 
}

Questions:

1.If a code file builds fine in windows could it fail to build in iOS?
2.In windows it automatically references the application directory
do I need to do something different in iOS?

Thanks for any help you can give.