Game Development Community

No AppData in T2D MIT?

by Peter Robinson · in Torque 2D Professional · 08/05/2015 (5:59 am) · 2 replies

Two weeks ago I finally started upgrading my game to T2D MIT! So far I have the title screen running. There's a lot that needs to be changed still. One thing that I recently came across I'd like to ask about. In legacy TGB when we saved or loaded a file (in my case, xml) it automatically routed it to the AppData folder (Library in MacOS). This was done because Vista and Windows 7 did not allow TGB to write to the program folder without running in admin mode. In T2D MIT this functionality is gone, which is bad for me because my save folders are over in AppData. I don't want users to have to start a new game when they upgrade just because I can't get to their saved games anymore.

So my question is, why? Is there some easy way to get the path to the AppData folder in script now so that we can just pass the path we actually want? If not I might have to add the code to get to the AppData folder back into the engine, which I would rather not do. What's the plan in a case like this?

Thanks for you help guys!

About the author

A programmer who has been using the Torque2D game engine since the early adopter days. My game is Pirate Code and it can be found at www.circuithive.com. It will be arriving on Steam in 2016.


#1
08/05/2015 (9:30 am)
You can retrieve the absolute path to the user's AppData directory in TorqueScript using getUserDataDirectory() of which does not include the usual '<gamecompany>/<gamename>' sub directory path. You'll have to append those yourself and then you can use that path when doing file I/O with with user data.

I don't know why the automatic file I/O sandboxed to AppData directory was removed in T2D.

#2
08/05/2015 (10:02 am)
That's exactly what I was hoping for. Thanks!