Serious issue with RenderTexture saveToDisk [Solved!]

[I just solved this, but leaving it here in case it’ll help anyone else] I realized that I didn’t actually call FileUtils::getInstance()->setWritablePath(my_path), I was just using my path. Now everything is working great!

I just realized that I’m having a serious problem with this function. I have an in-game editor that worked great last year, but this year I’ve changed my writablePath to use a folder under the Documents folder. This makes it so much easier for the users than using appdata/local.

However, now the RenderTexture::saveToDisk is still writing to the appdata/local subfolder, which means it’s broken for me. I’ll see if there’s a way to copy the image to the actual working folder after I create it (tricky, since it’s asynchronous).

Surely there’s a better solution? I don’t understand why I can’t give an absolute path to saveToDisk, nor why it’s ignoring my actual working directory.

thanks,
Dogwalker

1 Like

well, not quite. Works great on Windows, but I’m having problems on Mac. Haven’t tried iOS yet. I’ll work on those this weekend …

Hi,
You can try place a breakpoint here https://github.com/cocos2d/cocos2d-x/blob/v4/cocos/platform/apple/CCFileUtils-apple.mm#L238 and see if it returns the writable path that you have set, when the save function is invoked.

However, my guess is that the path that you’ve set might be wrong or not exactly writable (esp on iOS i only know of the default writable path).