Game Development Community

1.5 File I/O Issues

by Adam Chard · in iTorque 2D · 10/07/2011 (9:02 pm) · 3 replies

I'm working on updating a project previously developed in 1.3.1 to work in 1.5 with the intention of supporting all the nifty new features like Universal Support, but I'm running into a problem with the File I/O that may be a show stopper for us.

For our save system, we're using the export command to write all the global data from a "$Save::*" namespace to a file. The existing code looks something like this:
%dataFile = "./saveData" @ %slot @".dat";
export( "$Save::*", expandFilename( %dataFile ), false );

Which is later read in like so:
%dataFile = "./saveData" @ %slot @".dat";
%userDataFile = expandFilename( %dataFile );
if ( isFile( %userDataFile ) )  
{  
    // Read the File.  
    %saveFile = new FileObject();  
    %saveFile.openForRead( %userDataFile );  

    while ( !%saveFile.isEOF() )  
    {  
        // Eval Contents.  
        eval( %saveFile.readLine() );  
    }  
}

But in 1.5 it seems the file i/o code has been changed, since now that same code is trying to write the file in the scripts folder, which fails to create the file (since the .app directory is read-only on target). If I need to use a different method for saving (such as writing strings to the plist) I will, but somehow I need to be able to load existing save files. Otherwise users would lose all their progress when they update. Is there any way I can reverse the changes to file i/o so I can load existing save files?

About the author

Recent Threads


#1
10/07/2011 (9:38 pm)
sure just use the installed FileMerge or another merge tool and find the change. should be within a single file basically
#2
11/27/2011 (12:24 am)
@Adam. We are doing the same thing and I just discovered this to be an issue for our update. How did you make out? Did you find a solution?