cocos2d x - CCFileUtils::getWriteablePath() returns the CacheDirectory? -
i notice ccfileutils::getwriteablepath() returns cachedirectory, not documentdirecotry, suppose according note. there proper reason doing this? or bug? here's code ccfileutils.mm
std::string ccfileutils::getwriteablepath() { // save document folder nsarray *paths = nssearchpathfordirectoriesindomains(nscachesdirectory,nsuserdomainmask,yes); nsstring *documentsdirectory = [paths objectatindex:0]; std::string strret = [documentsdirectory utf8string]; strret.append("/"); return strret; }
ok, here's hard learned life lesson: don't expect cocos2d documentation accurate. ;)
personally think method badly named. if returns cache directory should in method name. if consider cache directory may emptied when device low on storage memory, it’s particularly bad idea store savegames there.
there other writable paths, commonly documents dir (for user documents) or application support directory (where have create subfolder app , should store files user should not manipulate).
most devs save documents, not place games store files to. savegames, game settings, , on don't belong documents directory rather application support. aren't user created, user modifiable documents.
what belongs documents screenshots user took, levels user designed, , else user created on own , may want use or modify outside app.
Comments
Post a Comment