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 - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -