简体   繁体   English

为什么Libgdx的AssetManager使用“ /”而不是“ \\”

[英]Why does Libgdx's AssetManager use “/” instead of “\”

According to libgdx's wiki on AssetManager they use "/" as their file separator. 根据libgdx在AssetManager上的Wiki,他们使用“ /”作为文件分隔符。 https://github.com/libgdx/libgdx/wiki/Managing-your-assets https://github.com/libgdx/libgdx/wiki/Managing-your-assets

When I tried using java.io.File.separator as the separator the asset manager would throw errors at run-time. 当我尝试使用java.io.File.separator作为分隔符时,资产管理器将在运行时引发错误。 Why does libgdx use Unix's file separator when I'm working on windows? 在Windows上工作时,libgdx为什么使用Unix的文件分隔符?

Actually its java that uses "\\". 实际上,它的Java使用“ \\”。 It is a start of the escape sequence like "\\b", "\\n", "\\f" etc. So "\\" cannot be used as file separator. 它是转义序列的开始,例如“ \\ b”,“ \\ n”,“ \\ f”等。因此,“ \\”不能用作文件分隔符。 If still want to use "\\" then use "\\\\" 如果仍然要使用“ \\”,请使用“ \\\\”
Eg "C:\\\\libgdx\\\\myProject\\\\..and so on" 例如 "C:\\\\libgdx\\\\myProject\\\\..and so on"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM