fspp/
lib.rs

1#![allow(dead_code)]
2
3mod path;
4pub use path::*;
5
6#[cfg(feature = "filesystem")]
7#[cfg(feature = "archive-module")]
8/// Interacting with archive files
9pub mod archive;
10
11#[cfg(feature = "location")]
12/// Get OS specific paths to places like home, config, cache, etc...
13pub mod location;
14
15#[cfg(feature = "filesystem")]
16/// Interacting with files
17pub mod file;
18
19#[cfg(feature = "filesystem")]
20/// Interacting with directories
21pub mod directory;
22
23#[cfg(feature = "filesystem")]
24/// Moving, copying, deleting, etc... (works with both files and directories)
25pub mod fs_action;
26
27#[cfg(feature = "safe_filename_string")]
28#[inline(always)]
29/// Convert a string to something safe to use in a filename
30pub fn filename_safe_string<S: AsRef<str>>(string: S) -> String {
31    filenamify::filenamify(string)
32}
33
34#[test]
35fn test() {
36    if std::env::consts::OS == "windows" {
37        assert!(Path::SPLIT_CHAR == '\\');
38        assert!(Path::NOT_SPLIT_CHAR == '/');
39    }
40
41    else {
42        assert!(Path::SPLIT_CHAR == '/');
43        assert!(Path::NOT_SPLIT_CHAR == '\\');
44    }
45}