Game Development Community

iT2D 1.4 Beta 2 - Files being created outside project area - RESOLVED

by Edward F. Maurina III · in iTorque 2D · 05/29/2010 (1:38 pm) · 3 replies

Build: 1.3, 1.4 Beta1, and 1.4 Beta 2

Platform: Windows (others not tested)

Target: Stand Alone (iTorque2DGame.exe)

Issues: After much experimentation and some forum reading, I discovered that iTGB v*.* seems to create a number of files outside of the expected ~/, ./, /, and ^/ locations. Specifically, under windows a large number of files are being created under:

C:/Users/<username>/AppData/<varies>/GarageGames/Torque Game Builder(iPhone)

This is troubling for a number of reasons:
1. Prevents generation of files under Windows/OS X version which are simply read when running device version. (A development trick to simplify my life.)

2. May be contributing to a common problem where .UFT files are missing when running on the iPhone Device.

3. Makes it difficult to do simultaneous development on multiple projects on the same machine. If files from multiple projects are being generated to the same common location you're going to get odd conflicts.

4. It is very troubling to have any application, including an 'under development' game generating files to someplace unknown on my machine.

My guess is that this came about as a side-effect for solving some iDevice requirement, but I'd love to see this fixed.

I guess the bottom line is, if I create a project in "C:/MyProject" I want all of the files from that project to stay and be created there. I don't want files being generated in other locations.

Steps to Repeat:
1. Add this code to /main.cs

// File Write / Read Test
%outFileName = "easyFind.cs";
%outFile = new FileObject();
if( (%outFile.openforWrite( %outFileName ) ) )
{
   %outFile.writeLine("This is a test");
}
%outFile.close();
%outFile.delete();
   
%inFileName = "easyFind.cs";
%inFile = new FileObject();
if( (%inFile.openForRead( %inFileName ) ) )
{
   %input = %inFile.readLine();
   echo(%input);
}
%inFile.close();
%inFile.delete();

2. Run the game.

3. Notice "easyFind.cs" is NOT in the root directory of your game project as you would expect.

Suggested Fix:
Do not allow iTGB (on Windows and OS X) to create files outside of the game directory.


Extra Notes:
Please note that this problem has been seen and talked about before.

#1
05/29/2010 (5:08 pm)
Above code would never work anyway I fear if it was implemented as you want it to.
You are not allowed to write / delete any files in your project folder on the iphone at all.


The place where it creates them is actually not "unknown" at all. its the standard place where dynamically created files from applications are meant to go as "non enduser visible files" since Windows XP and since Vista its enforced, it fails if you try to create files in the program files / program files (x86) folder.

What I would recommend to do is create a link to it so you don't have to go through the folders everytime again.
Or what would potentially make sense is adding a button to iTGB to open the folder.



Sidenote: Just in case you are doing some interactions on the ObjC end too.
You can write into the applications private documents folder which you can request through

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
#2
05/29/2010 (5:57 pm)
As Marc said, this is the expected File I/O behavior on Windows now. With TGB 1.7.5's release we listed it as a known issue so that people would be aware of it. The documentation was updated to reflect it as well. When it comes time to certify 1.4 for release I'll make sure to list it as a known issue for it as well.
#3
05/29/2010 (7:22 pm)
I guess I'm just used to operating a little differently from most.

I prefer to have my entire game and tool-set in one directory (not under program files (x86)), so I can easily backup and move my data. I never install under the programs folder because I heavily modify the tools and other files per-project.

Additionally, (using TGB 1.7.4) I frequently generate files for use in the game later. My intention in this case was to dynamically generate the proper datablock files (per-level) on Windows (and the simply read them on the device).

So, you're telling me, games can't generate any files in their local space on Windows using iTGB and/or TGB 1.7.5.

Well, thanks for the replies and the info.

-Ed M.

PS - Lest there be any confusion, the snippet of code (original post) was just a test of write/read to figure out where my files were going with as little interference as possible. My datablock generation code was a bit more complex.