#path #unix #windows #backslash #path-utils

fuck-backslash

A simple crate to replace the backslash with slash in-place in your PathBuf

1 unstable release

0.1.0 Jan 3, 2025

#763 in Rust patterns

Download history 136/week @ 2025-01-02

136 downloads per month

MIT license

4KB

fuck-backslash

Did you suffer from the problem that \ breaks your path? For me, I have to record paths into a configuration file and use it cross-platform. If I create the configuration on windows, it will break my program when I run it on linux.

This is a simple crate to replace the backslash \ with slash / in-place in your PathBuf.

Usage

use fuck_backslash::*;

let path = PathBuf::from("C:\\Users\\xxx\\Desktop\\test.txt");
assert_eq!(path.fuck_backslash(), PathBuf::from("C:/Users/xxx/Desktop/test.txt"));

No runtime deps