Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
save files — Gideros Forum

save files

orktechorktech Member
edited November 2011 in General questions
I've been wondering, where do all my save files go? I can reference them from code but can't find in any folder . I create files in game. I really need to see my custom created xml files. Thanks
«1

Comments

  • On Android, on my phone, they end up in /sdcard/gideros/[YOUR APP NAME]/ at least when testing with the player.

    Likes: atilim

    +1 -1 (+1 / -0 )Share on Facebook
  • Also, if they aren't huge, maybe you could read and print them to the console. :)
  • Ok. Well how about player. I think it would be useful to file on my PC before testing on Actual device. For example in networking tutorial
    local out = io.open("|D|imageUnique.png", "wb")
    out:write(loader.data)
    out:close()

    where can I see image on PC, to what folder does |D| lead for emulator
  • atilimatilim Maintainer
    on Windows XP: C:\Documents and Settings\[YOUR USER NAME]\Local Settings\Temp\gideros\[YOUR APP NAME]
    on Windows Vista and Windows 7: C:\Users\[YOUR USER NAME]\AppData\Local\Temp\gideros\[YOUR APP NAME]
    on Mac OS X: Currently I don't know. Let me look at it :)

  • atilimatilim Maintainer
    on Mac OS X: $TMPDIR/gideros/[YOUR APP NAME]
  • atilimatilim Maintainer
    Also for windows you can use %TEMP%\gideros\[YOUR APP NAME]
  • WOW, thanks for fast reply =D>
  • atilimatilim Maintainer
    edited November 2011
    np :)

    One addition to Stoffe's answer: There is no normal way to access these files on iOS :)
  • and another question, is there a way to set specific folder for saving data. I mean in projects folder data/ would seem logical. And everything stored in the folders you directed me looks like "bin/" for VisualC projects, which location would be cool to specify as well. Thanks
  • atilimatilim Maintainer
    We can put an option to specify this directory or provide a way for easy accessing to it.

    On the other hand, project directory may not be a good idea for this purpose. Because if somebody already creates a data/ directory for his/her own use and then we write on it, there would be problems.
  • On Android, on my phone, they end up in /sdcard/gideros/[YOUR APP NAME]/ at least when testing with the player.
    This doesn't happen on my phone (Galaxy Nexus). I can't seem to find the file anywhere.
    Using the Player (Linux using Wine) I find the file in the Windows XP location atilim mentioned above, but it gets erase on every relaunch of the app.

    How can I save an access on next startup?
    I found a nice code package persistence.lua for saving and load tables http://the-color-black.net/blog/article/LuaTablePersistence
  • Save table: http://www.giderosmobile.com/forum/discussion/367

    On IOS: Start Xcode Organizer. There you can download the content of your document directory.

    But make sure, that you have saved your data into it. If you don't then read up on the file system:

    http://www.giderosmobile.com/documentation/file_system.html

    Likes: chipster123

    +1 -1 (+1 / -0 )Share on Facebook
  • If the save files are inside the iOS device app sandbox, you can see them using the free iExplore:
    http://www.macroplant.com/iexplorer/
  • ar2rsawseenar2rsawseen Maintainer
    edited February 2012
    If I want to save, for example, game progress, unlocked levels, scores etc in document directory:
    Is there some more secure storage, not accessible by phone user?
    Or it is better to encrypt data?
    Or I am paranoid?
  • atilimatilim Maintainer
    edited February 2012
    @chipster123 both issues are interesting. Do you know where your sdcard is mounted? Is it mounted at /sdcard as usual?

    @ar2rsawseen Most probably, I prefer not to spend time to encrypt the data. I've looked at a bunch of popular iOS games and see that they are usually using NSUserDefaults class (save their progress as .plist file) and I can see all their progress, etc. with Property List Editor. But you always have option to implement your own encryption algorithm.
  • atilimatilim Maintainer
    @Caroline thanks for the iExplorer :) Most probably I'm going to use it all the time.
  • chipster123chipster123 Member
    edited February 2012
    @mike. Thanks. I have to get better at finding things in the forum
    @atilim, i think the |D| will solve it.
  • Update: the files are save on my development machine running Linux/wine in Windows XP mode in the following location:
    /home/chip/.wine/drive_c/windows/profiles/chip/Temp/gideros/blockschedule/documents/

    The save/load works now (thanks ndoss for the extra help)

    But running it on the Galaxy Nexus/ICS there is no directory 'gideros' created in /sdcard (/sdcard/gideros/...) so the save/load doesn't work. I'm looking for where the save file may have gone because it didn't throw any errors at run time.

    It couldn't have anything to do with the fact that this phone has no external sd card? It has two mount points /mnt/sdcard and /sdcard, both of which are the same "physical" directory.

  • atilimatilim Maintainer
    Hi @chipster123,

    If you can see the output of logcat, can you look for a log like:
    "externalDir: ****" and "internalDir: ***" Gideros Player uses the externalDir while exported application uses internalDir.

  • chipster123chipster123 Member
    edited March 2012
    Using Gideros v2012.2

    Using a simple project and this simple test code demonstrates the problem.
    function createFile(filename)
       file,err = io.open(filename,"w")
       if err then
          print ("failed to open "..filename)
       else
          print ("created file "..filename)
       end
    end
     
    filename="|T|gid_tmp.txt"
    createFile(filename)
     
    filename ="|D|gid_doc.txt"
    createFile(filename)
     
    filename = "|R|dig_res.txt"
    createFile(filename)
    Running logcat on the Nexus gives
    D/Gideros_Java(32737): externalDir: /mnt/sdcard
    D/Gideros_Java(32737): internalDir: /data/data/com.yourdomain.yourapp/files
    D/Gideros_Java(32737): cacheDir: /data/data/com.yourdomain.yourapp/cache
    But no gideros directory is created.

    On my dev machine
    find /home/chip/.wine/drive_c/ -name 'gid_*'
    /home/chip/.wine/drive_c/windows/profiles/chip/Temp/gideros/saveFile/documents/gid_doc.txt
    /home/chip/.wine/drive_c/windows/profiles/chip/Temp/gideros/saveFile/temporary/gid_tmp.txt
    I'll have to try on my og droid
  • atilimatilim Maintainer
    edited March 2012
    Hi @chipster123,

    I've copy-pasted your code, exported as an Android application and run it.
    I can see that gid_doc.txt is created at:
    /data/data/com.giderosmobile.chipster123savefiles/files/gid_doc.txt
    and gid_tmp.txt is created at:
    /data/data/com.giderosmobile.chipster123savefiles/cache/gid_tmp.txt

    Exported applications don't use sdcard, only player uses it.

    If I run your code through Player, I can see the files at /sdcard/gideros/chipster123savefiles

  • chipster123chipster123 Member
    edited April 2012
    @atilim, thanks for testing that. That's another thing i forgot to mention, i'm using exported application. (The player doesn't work on ICS).

    EDIT: Update 4/1/2012 - the player works for ICS. Pilot error.

    I can't navigate into the /data partition.
    shell@android:/ $ cd /data
    shell@android:/data $ ls
    opendir failed, Permission denied
    This isn't a Gideros problem, but the exported app isn't behaving like the PC player and I can't figure out how to debug it.

    I'll have to re-read all the things related to gideros and building for android then get back to you.
  • atilimatilim Maintainer
    edited March 2012
    The player doesn't work on ICS.
    Oh, I thought we had fixed that bug before. Let me test again.


    Although you cannot get the directory listing, you can navigate through (at least on my Android phone):
    $ cd /data
    $ ls
    opendir failed, Permission denied
    $ cd /data/data/com.giderosmobile.chipster123savefiles/files
    $ ls -l
    opendir failed, Permission denied
    $ pwd
    /data/data/com.giderosmobile.chipster123savefiles/files
    $ ls -l gid_doc.txt
    -rw-rw-rw- app_192  app_192         0 2012-03-03 01:01 gid_doc.txt
  • [SOLVED] (BTW, @atilim - that worked for me.)
    The issue all along :\"> was that at some point the installed application didn't update the one I was clicking on. It installed another instance of the application. I figured it out when I found the application with the generic gideros icon instead of the one I made. I was selecting the one with my icon. Again :\"> I must have changed something I didn't realize.

    Thanks for all your testing @atilim. Now, how should I go back through this post and denote [SOLVED] ?
  • fawzmafawzma Member
    edited March 2012
    Turn this into a plugin for ios

    + (void) saveStat : (int) v : (NSString*) key
    {
    [[NSUserDefaults standardUserDefaults] setInteger:v forKey:key];
    [[NSUserDefaults standardUserDefaults] synchronize];
    }

    + (int) loadStat : (NSString*) key
    {
    id v;
    int n = 0;
    NSUserDefaults *standardUserDefaults = [NSUserDefaults standardUserDefaults];
    if (standardUserDefaults) {
    v = [standardUserDefaults objectForKey:key];
    n = [v intValue];
    }
    return n;
    }

    c functions to call obj-c

    static int saveStat(lua_State* L)
    {
    const char *s = luaL_checkstring(L, 1);
    int v = luaL_checkinteger(L,2);

    NSString *str = [NSString stringWithFormat:@%s,s];

    [GameKitHelper saveStat:v :str];

    return 0;
    }

    static int loadStat(lua_State* L)
    {
    const char *s = luaL_checkstring(L, 1);
    NSString *str = [NSString stringWithFormat:@%s,s];

    int v = [GameKitHelper loadStat:str];
    lua_pushinteger(L, v);

    return 1;
    }
  • phongttphongtt Guru
    edited July 2012
    on Mac OS X: $TMPDIR/gideros/[YOUR APP NAME]
    Until today I have a need for this but it doesn't seem to work. @atilim? Anyone?

    *Edit: OK, I was out of my mind. But digging this thread should bring good info for new members :-"
  • This should be a sticky - or at least referenced in a FAQ somewhere.

    Hmm - I wonder, could we have a forum category called "important s*** you'll need to know eventually" that is read only and then mod's could put important posts like this in it?

    Likes: hgvyas123

    WhiteTree Games - Home, home on the web, where the bits and bytes they do play!
    #MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
    +1 -1 (+1 / -0 )Share on Facebook
  • ar2rsawseenar2rsawseen Maintainer
    edited July 2012
    Even better idea. Make @techdojo a mod.
    Hmm, no scratch that, I just imagined what would happen if someone will take away his silver star :D
  • @ar2rsawseen: Nooooooooooo!!!!!! He'd become intoxicated with the power and there's no telling what he'd do then..
  • Go ahead - It wouldn't be the first time I've had "powers beyond that of mortal humans" :) - the power to spit the dummy faster than a speeding bullet, to leap to tall conclusions in a single bound and squash bugs with only the power of his mind :)
    WhiteTree Games - Home, home on the web, where the bits and bytes they do play!
    #MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
Sign In or Register to comment.