Game Development Community

iT2D 1.5 Preview 1 - SimObject save bug on actual device - RESOLVED (ITGB-209)

by Tim Newell · in iTorque 2D · 07/06/2011 (10:02 am) · 2 replies

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

Issue: SimObject save function is not working on the actual device. I do not think I caused this issue with my local copy but I have not confirmed it with stock. Platform::getPrefsPath (in PlatformFileIO.cc) is called twice when SimObject save is called. the first time on iOS device it appends ../Documents and the second time around this code is triggered and simobject fails to save.

#ifdef TORQUE_OS_IPHONE
	if(file)
	{
		if(dStrstr(file, "..") || dStrstr(file, "./") || dStrstr(file, "~/"))
		{
			Con::errorf("getPrefsPath - Filename (%s) cannot be relative.", file);
			return false;
		}

...

Step to Reproduce:
1) Write some script that calls the simObject save method.
2) Check if file was created

Suggested Fix: Not sure of best fix but my hack was to change the above Con::errorf and return false to instead just return the file that was passed in since the path is already created correctly the first time it was called. This solution might cause issues in other areas I have not noticed yet though.