Directory separator as STD const

In PHP, there is DIRECTORY_SEPARATOR constant, useful for Windows and Unix paths resolve, what about Rust?

Thoughts use with .replace("/", "-"), not sure I want operate with strings regex, array or multiple replace chain here

UPD seems, found it:

std::path::MAIN_SEPARATOR

What are you trying to solve? If you are trying to replace all separator in a path with some other symbols to generate a single identifier, I think you should call Path::components and compose the components.

2 Likes

At this moment just trying to replace "/" with const, as updated before, solution found:

std::path::MAIN_SEPARATOR

Thanks, closed!