Get directory separator char on Windows? ('\', '/', etc.)

后端 未结 3 789
耶瑟儿~
耶瑟儿~ 2020-12-06 16:09

tl;dr: How do I ask Windows what the current directory separator character on the system is?


Different versions of Windows seem to behave differently (e.g.

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-06 16:36

    The standard forward slash (/) has always worked in all versions of DOS and Windows. If you use it, you don't have to worry about issues with how the backslash is displayed on Japanese and Korean versions of Windows, and you also don't have to special-case the path separator for Windows as opposed to POSIX (including Mac). Just use forward slash everywhere.

提交回复
热议问题