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

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -