1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
use crate::dpds_path::{Display, Error};
#[derive(Debug)]
pub enum OsPathError {
UnixPathIncorrect,
WindowsPathIncorrect,
PathIsEmpty,
SystemNotDefined,
}
impl Error for OsPathError {}
impl Display for OsPathError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match *self {
OsPathError::UnixPathIncorrect => f.write_str("You are using the windows path format for Unix. Use `unix` format for the path:\n> ./folder1/folder2/file.txt\n> ../folder2/file.txt\n> ./file.txt"),
OsPathError::WindowsPathIncorrect => f.write_str("You are using the unix path format for Windows. Use `windows` format for the path:\n> .\\folder1\\folder2\\file.txt\n> ..\\folder2\\file.txt\n> .\\file.txt"),
OsPathError::PathIsEmpty=>f.write_str("The path is empty"),
OsPathError::SystemNotDefined =>f.write_str(" SystemNotDefined"),
}
}
}