Game Development Community

Files location in tgb 1.7.2

by Daniel Jami · in Torque Game Builder · 04/14/2008 (7:45 am) · 2 replies

Hi

i worked with tgb 1.5 and after months i want to make a game . i make a lot but now i have some problems ...
one of them ! is about files location . i use this code in tgb 1.1.3 :
%file = new FileObject();
   if(%file.openForWrite("~/save/test.sav"))
   {
      %file.writeLine("test");
      echo("File Written");
   }
   %file.close();
   %file.delete();

in tgb 1.5 it creates test.sav in my game directory but now in tgb 1.7.2 the created file is in :

C:\Documents and Settings\mojtaba\Application Data\Independent\UntitledGame\game\save

i also try this :

%file = new FileObject();
   if(%file.openForWrite(expandFilename("~/save/test.txt")))
   {
      %file.writeLine("test");
      echo("File Written");
   }
   %file.close();
   %file.delete();

and i get a same result .

please help me . a have a headache because of it .

//////////////////////////////////////////////////////////////////////////////////////////////////////////

i also want to copy and rename a file . i did it with this code it past :

pathcopy("~/save/image.png", "~/save/renamedImage.png", false);

but it doesnt work now

please help me if you know about it !

thanks

#1
04/14/2008 (12:46 pm)
As of TGB 1.5 you cannot write to the game folder. It is now a Windows standard to store save game files in the AppData folder and Torque abides by that standard.

I would imagine that the pathCopy function has been removed or altered for this reason also.
#2
04/14/2008 (7:18 pm)
Thank

yes .i make mistake . i was working with tgb 1.1.3 not 1.5 .(i forgoted ... )

for now i accept this location and my game work with it . for openForRead i found that it first search ur game folder and if can not find the file in that location it search the AppData folder <- maybe help someone !

and about path copy . i need it for create shots for my saves . i have 6 place for my saves . every time i go from a game screen to menuGame it takes a screen shot with :

Screenshot( expandFilename("~/save/ImageShot.png"), "png" );

now i have a shot from my game and when i click on every save place i should copy ImageShot.png and rename it so my GuiBitmapCtrl can use it ... i did it with 1.1.3 but now :( any idea ?!