Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Bug: os.remove doesn't support |D|, |R|, |T| directories — Gideros Forum

Bug: os.remove doesn't support |D|, |R|, |T| directories

DaleDale Member
edited September 2012 in Bugs and issues
There seems to be no way to remove a file in the document directory (for example), since the path is hidden, and |D| does not appear to work for os.remove() to specify the document directory.

Likes: DarkPixel

Dislikes: Scouser, nelinho

+1 -1 (+1 / -2 )Share on Facebook

Comments

  • bowerandybowerandy Guru
    edited September 2012
    @Dale, if you are using my BhSnapshot plugin (as you hinted earlier) there is a helper method defined in there called pathForFile() that will return a full path for a given file name (including ones that contain |D|).

    You can call it like:
    require "BhSnapshot"
    print(BhSnapshot.getPathForFile("|D|MyDocFile.txt"))
    which on my device, yields:
    /var/mobile/Applications/9901F6E8-A761-421D-A55F-F36E0BDF3EC1/Documents/gideros/BhItemSlider/documents/MyDocFile.txt

    Alternatively add the following method to a plugin of your choice:
    static int getPathForFile(lua_State *L) {
        NSString* filename = [NSString stringWithUTF8String: luaL_checkstring(L, 1)];
        lua_pushstring(L, g_pathForFile([filename UTF8String]) );
        return 1;
    }
    Best regards
  • I also see that in the latest version of Gideros (2012.8.2) there is a change:

    http://www.giderosmobile.com/DevCenter/index.php/Release_notes

    Note the the bug fix ("Bug: os.remove and os.rename doesn't transform path names"). I haven't tried this version yet but it may do what you want directly.

    Best regards
  • atilimatilim Maintainer
    as @bowerandy said, it was fixed in the latest version.
  • DaleDale Member
    edited September 2012
    Excellent, thanks @atlim (and @bowerandy for the useful utility function)!

    On a slightly related, and less critical note:

    I sometimes find it handy to test and distribute (for beta versions) my app via Cydia. This fails for me, with Gideros.

    It turns out that Cydia doesn't put the app in /var/mobile/Applications/[uid]/AppName like the app store does, so it appears |D|,|R| (at least) fail to find a useful path.

    (As a workaround, if opening my database in the document dir fails, I then create a /var/mobile/Library/AppName/ directory, and open the file there instead. That seems to work.)

    I'm not sure if this is something that Gideros really needs to address or not. I thought I'd mention it here in case others came across problems when using Cydia.

    Thanks,

    -d
  • @Dale interesting way to distribute betas via Cydia. Have not tried that yet, but we are using testflight to distribute betas, and Gideros works flawlessly.
    have fun with our games~
    http://www.nightspade.com
Sign In or Register to comment.