在 Rust 中是否有任何可用的选项来获取特定于平台的文件分隔符?
可以有不同的平台特定分隔符:
let separator = "\\" // Could be this.
let separator2 = "/" // Could be this.
let separator3 = "//" // Could be this.
我看起来像以下内容:
let env_independent_seperator = env::separator()
那么它的用法可能如下:
let folder = "C\\Folder\\Path";
let env_independent_separator = env::separator() // Looking something like this
let file_name = "File.txt";
let full_path = folder+ env_independent_separator + file_name;
File::separator()
Rust 中有吗?