Game Development Community

iT2D 1.4 - isFile() and OpenForRead() broken - RESOLVED

by Dean Parker · in iTorque 2D · 07/12/2010 (12:17 am) · 4 replies

Build: 1.4

Platform: Windows 7, iTGB, Xcode 4.0

Target: iTGB

Description:
The commands always returns false. isFile() and OpenForRead()
NOTE: OpenForWrite() works.

Steps to Repeat:
1. Open any example project.

2. Create filename.dat in the users directory.

3. Add the code

function testfound()
{
   %file = new FileObject();
   %file.OpenForWrite("settings.dat");
   %file.writeline("$settings::music =true;");
   %file.close();
   %file.delete();

   if (isFile("settings.dat"))
      echo ("Found");
   else
      echo ("NOT Found");
}

function testopen()
{
   %file = new FileObject();
   %file.OpenForWrite("settings.dat");
   %file.writeline("$settings::music =true;");
   %file.close();
   %file.delete();

   %file = new FileObject();

   if(%file.OpenForRead("settings.dat"))
     echo ("Open");
   else
     echo ("NOT Open");

   %file.close();
   %file.delete();
}

4. In the game.cs after the level loads call the function testfound(); and testopen();

5. Run and it returns false.

Note: I have tested this on iphone and it does not keep settings, it always creates a new file.

About the author

I started programming in early 80's on an Atari 800 and now I am coding on VS 2008 C#.


#1
08/05/2010 (11:34 pm)
Hi.
Same problem, my suggestion to fix it is here www.torquepowered.com/community/forums/viewthread/118719/1#comment-768053
#2
08/06/2010 (1:08 am)
Juraj

Thanks for the info, I will update my source code. I did find a work around..

Change...
%file = new FileObject();

  %file.openForRead("settings.dat");

To...
%file = new FileObject();
  // BEGIN work around
  %file.openForAppend("settings.dat");
  %file.close();
  // END work around
  %file.openForRead("settings.dat");
#3
08/24/2010 (8:32 pm)
Logged in Jira bug tracker as ITGB-79. Marked for 1.4.1 release.
#4
02/10/2011 (6:20 pm)
Fixed in 1.4.1.