file_storage/path/system/
is_unix.rs1use crate::StoragePath;
2
3impl StoragePath {
4 pub fn is_unix_path(&self) -> bool {
8 Self::is_unix_path_str(self.path())
9 }
10
11 pub fn is_unix_path_str<S>(path: S) -> bool
13 where
14 S: AsRef<str>,
15 {
16 path.as_ref().starts_with('/')
17 }
18}
19
20#[cfg(test)]
21mod tests {
22 use crate::StoragePath;
23
24 #[test]
25 fn is_unix_path_str() {
26 assert!(StoragePath::is_unix_path_str("/"));
27 assert!(StoragePath::is_unix_path_str("/usr/bin"));
28 assert!(StoragePath::is_unix_path_str("/file.txt"));
29
30 assert!(!StoragePath::is_unix_path_str("C:\\"));
31 assert!(!StoragePath::is_unix_path_str("relative"));
32 assert!(!StoragePath::is_unix_path_str(""));
33 }
34}