File tree Expand file tree Collapse file tree 2 files changed +6
-13
lines changed Expand file tree Collapse file tree 2 files changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -40,9 +40,7 @@ def self.normalize_win_path(*strs)
40
40
41
41
# Parse the path prefix
42
42
prefix = ( s [ 0 ] || '' ) . gsub ( /[\* <>\? \/ ]/ , '' )
43
- if prefix . empty?
44
- prefix = '\\'
45
- elsif prefix =~ /^\w :$/ and s . length == 1
43
+ if prefix =~ /^\w :$/ and s . length == 1
46
44
prefix += '\\'
47
45
end
48
46
Original file line number Diff line number Diff line change 12
12
described_class . normalize_win_path ( 'C:\\hello\\world' ) . should eq ( "C:\\ hello\\ world" )
13
13
end
14
14
15
+ it "should convert a relative path" do
16
+ described_class . normalize_win_path ( '/' , 'test' , 'me' ) . should eq ( "\\ test\\ me" )
17
+ described_class . normalize_win_path ( '\\temp' ) . should eq ( "\\ temp" )
18
+ end
19
+
15
20
it "should convert a path without reserved characters" do
16
21
described_class . normalize_win_path ( 'C:\\' , 'Windows:' ) . should eq ( "C:\\ Windows" )
17
22
described_class . normalize_win_path ( 'C:\\Windows???\\test' ) . should eq ( "C:\\ Windows\\ test" )
22
27
described_class . normalize_win_path ( 'C:\\\\\\Hello World\\\\whatever.txt' ) . should eq ( "C:\\ Hello World\\ whatever.txt" )
23
28
described_class . normalize_win_path ( 'C:\\\\' ) . should eq ( "C:\\ " )
24
29
end
25
-
26
- it "should parse UNC path format as an array or a string" do
27
- described_class . normalize_win_path ( '\\\\127.0.0.1' , 'C$' ) . should eq ( "\\ \\ 127.0.0.1\\ C$" )
28
- described_class . normalize_win_path ( '\\\\127.0.0.1\\C$' ) . should eq ( "\\ \\ 127.0.0.1\\ C$" )
29
- end
30
-
31
- it "should parse a relative path in Windows format" do
32
- described_class . normalize_win_path ( '\\\\127.0.0.1' , 'C$' ) . should eq ( "\\ \\ 127.0.0.1\\ C$" )
33
- described_class . normalize_win_path ( '\\\\127.0.0.1\\C$' ) . should eq ( "\\ \\ 127.0.0.1\\ C$" )
34
- end
35
30
end
36
31
37
32
context ".normalize_unix_path" do
You can’t perform that action at this time.
0 commit comments