Game Development Community

iT2D 1.5 Preview 1 - getGameDataDirectory returns wrong path on device - LOGGED (ITGB-207)

by Tim Newell · in iTorque 2D · 07/08/2011 (10:26 am) · 1 replies

Build:1.5 Preview 1
Platform: Device and Simulator
Target: Device

Issue: When calling getGameDataDirectory() it returns an invalid path for the device.

Step to Reproduce:
1) call getGameDataDirectory() and receive an invalid path for the device filesystem

Suggested Fix: This is the code I used to fix it for the game I am working on. I added the #ifdef TORQUE_OS_IPHONE section.

ConsoleFunction(getGameDataDirectory, const char*, 1, 1, "() // retrieves the directory we're saving to.")
{
   char appDataPath[1024];
   #ifdef TORQUE_OS_IPHONE
   dStrcpy(appDataPath, "../Documents");
   #else
   dSprintf(appDataPath, sizeof(appDataPath), "%s/%s/%s", Platform::getUserHomeDirectory(), sgCompanyName, sgProductName);
   #endif
   return StringTable->insert(appDataPath);
}