Skip to main content

typed_path/windows/
constants.rs

1/// The primary separator of path components for windows platforms
2pub const SEPARATOR: char = '\\';
3
4/// The primary separator of path components for windows platforms
5pub const SEPARATOR_STR: &str = "\\";
6
7/// The alternate separator of path components for windows platforms
8pub const ALT_SEPARATOR: char = '/';
9
10/// The alternate separator of path components for windows platforms
11pub const ALT_SEPARATOR_STR: &str = "/";
12
13/// Path component value that represents the parent directory
14pub const PARENT_DIR: &[u8] = b"..";
15
16/// Path component value that represents the parent directory
17pub const PARENT_DIR_STR: &str = "..";
18
19/// Path component value that represents the current directory
20pub const CURRENT_DIR: &[u8] = b".";
21
22/// Path component value that represents the current directory
23pub const CURRENT_DIR_STR: &str = ".";
24
25/// Reserved names (case insensitive) that cannot be used with files or directories
26/// for personal use (system only)
27pub const RESERVED_DEVICE_NAMES: &[&[u8]] = &[
28    b"CON", b"PRN", b"AUX", b"NUL", b"COM1", b"COM2", b"COM3", b"COM4", b"COM5", b"COM6", b"COM7",
29    b"COM8", b"COM9", b"COM0", b"LPT1", b"LPT2", b"LPT3", b"LPT4", b"LPT5", b"LPT6", b"LPT7",
30    b"LPT8", b"LPT9", b"LPT0",
31];
32
33/// Reserved names (case insensitive) that cannot be used with files or directories
34/// for personal use (system only)
35pub const RESERVED_DEVICE_NAMES_STR: &[&str] = &[
36    "CON", "PRN", "AUX", "NUL", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8",
37    "COM9", "COM0", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9", "LPT0",
38];
39
40/// Bytes that are not allowed in file or directory names
41#[allow(clippy::byte_char_slices)]
42pub const DISALLOWED_FILENAME_BYTES: &[u8] =
43    &[b'\\', b'/', b':', b'?', b'*', b'"', b'>', b'<', b'|', b'\0'];
44
45pub const DISALLOWED_FILENAME_CHARS: &[char] =
46    &['\\', '/', ':', '?', '*', '"', '>', '<', '|', '\0'];