Game Development Community

fileobject problem

by Steve D · in Torque Game Builder · 02/10/2009 (6:29 pm) · 2 replies

I'm still getting a handle on TGB but I can't figure out writing a simple text file. I brought over code from TGE but when it executes, the file object returns true for opening the file but the file never shows up. Here is the little snippet I made, any ideas? I've read and searched the forums but can't find anything relevant.

function WriteTest()
{
%file = new fileobject();

%filename = "~/data/saves/test.txt";

%filename = expandFilename(%filename);

%ret = %file.OpenForWrite(%filename);

%file.WriteLine("test");

%file.close();
}

#1
02/11/2009 (5:35 am)
For some silly security reasons TGB only writes to the "Application Folder" now, you can't create files inside the actual game directory. So check your Documents and Settings/username/Application Data folder if you're on windows.

I'm also having issues with this now trying to integrate the TGE auto updater resource. Everything works great, the md5 hashing, comparing directory structures etc... but when it goes to (over)write the outdated or missing files TGB can't/won't.
#2
02/11/2009 (5:55 am)
Ok got it, it was actually writing under the AppData/Roaming directory.