File tree 1 file changed +4
-2
lines changed
cap-primitives/src/windows/fs
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -10,12 +10,14 @@ pub(crate) fn open_impl(
10
10
) -> io:: Result < fs:: File > {
11
11
// Windows reserves several special device paths. Disallow opening any
12
12
// of them.
13
+ // See: https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions
13
14
if let Some ( stem) = path. file_stem ( ) {
14
15
if let Some ( stemstr) = stem. to_str ( ) {
15
16
match stemstr. to_uppercase ( ) . as_str ( ) {
16
17
"CON" | "PRN" | "AUX" | "NUL" | "COM0" | "COM1" | "COM2" | "COM3" | "COM4"
17
- | "COM5" | "COM6" | "COM7" | "COM8" | "COM9" | "LPT0" | "LPT1" | "LPT2"
18
- | "LPT3" | "LPT4" | "LPT5" | "LPT6" | "LPT7" | "LPT8" | "LPT9" => {
18
+ | "COM5" | "COM6" | "COM7" | "COM8" | "COM9" | "COM¹" | "COM²" | "COM³"
19
+ | "LPT0" | "LPT1" | "LPT2" | "LPT3" | "LPT4" | "LPT5" | "LPT6" | "LPT7"
20
+ | "LPT8" | "LPT9" | "LPT¹" | "LPT²" | "LPT³" => {
19
21
return Err ( io:: Error :: from_raw_os_error ( ERROR_FILE_NOT_FOUND as i32 ) ) ;
20
22
}
21
23
_ => { }
You can’t perform that action at this time.
0 commit comments