Getting at the save file

Monkey Forums/Monkey Programming/Getting at the save file

siread(Posted 2012) [#1]
Is there anyway of retrieving the save state data? It would greatly help with debugging if users could send me their save file. Where are they stored on each of the different platforms?


slenkar(Posted 2012) [#2]
on html5 you could print it to the console,
CTRl-A to select all and CTRL-C to copy the text


flash is a bit more difficult, it needs a console like html5 really
it might be next to the SWF ah dunno

on GLFW its the monkeystate file next to the EXE

as for Ios and Android...dunno


siread(Posted 2012) [#3]
Damn - they are the two I'm most interested in!


slenkar(Posted 2012) [#4]
heres what you could do,
compile to iOS run on emulator,
save the game
right click on the folder
search for .monkeystate

alternatively you could simply send the game state as a string over the internet, the player could push a button to report the error,
write a description and the save state gets sent too. You could either send it to your email or setup a server with script to recieve the message


jpoag(Posted 2012) [#5]
Well, for iOS, it looks like the state is saved in the app's plist file:

[prefs setObject:nsstr forKey:".monkeystate"];

If you don't know what a plist is, it's a file (currently in XML format although older files are in a binary format) that ships with your app. When the app is first run, a copy of the file is made in the user preferences directory. Then, subsequent runs reference that copy.

Look in ~/Library/Preferences/

Mojo adds a new key ".monkeystate" with the State as Text.

As for android, it is very similar, only the preferences file is stored at:
/data/data/YOUR_PACKAGE_NAME/shared_prefs/YOUR_PACKAGE_NAME_preferences.xml
and the key is "gxtkAppState"

The default package name is "com.monkey" so if you didn't change it (which you should) the state will be at:
/data/data/com.monkey/shared_prefs/com.monkey_preferences.xml