android - What is the path separator I should use in cocos2d-x to be platform independent? -


i building ios, android, , windows phone, , may support other platforms in future.

currently this:

std::string filename = resourcepath + "/" + result + ".plist"; 

it seems work ios (on simulator), haven't checked android / wp yet. right way add path separator ? there api or can use add separator correctly ?

this use path separator in code:

#if (cc_target_platform == cc_platform_win32) #define path_separator "\\" #endif #if (cc_target_platform == cc_platform_ios) #define path_separator "/" #endif #if (cc_target_platform == cc_platform_android) #define path_separator "\/" #endif  static const std::string separator = path_separator;  std::string nextbtnfilename = "images"+separator+"speech"+separator+"button_next.png"; 

hope helps!


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -