Commit 4a7be95
committed
Fix bug in unPathNative
When passing a path like "F:/foo/bar" on windows
(both '/' and '\' are valid path separators on windows)
we'll get garbage output like so:
> mkPathNative "F:/foo/bar"
"F:/foo/bar"
> unPathNative "F:/foo/bar"
"F:foo\\bar"
...effectively turning an absolute path into a relative path
("F:foo\\bar" on windows is the directory "foo\\bar"
relative to the current working directory on drive F).
This is because Posix and Windows splitDirectories behave differently:
> System.FilePath.Posix.splitDirectories $ "F:/foo/bar"
["F:","foo","bar"]
> System.FilePath.Windows.splitDirectories $ "F:/foo/bar"
["F:/","foo","bar"]
When joining paths on windows, the filepath library does not
assume a trailing path separator after the drive (here "F:").
This is because as described above, "F:foo" is valid relative
filepath.1 parent 67507e2 commit 4a7be95
File tree
2 files changed
+24
-3
lines changed- hackage-security
- src/Hackage/Security/Util
- tests
2 files changed
+24
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
74 | 77 | | |
75 | 78 | | |
76 | 79 | | |
| |||
118 | 121 | | |
119 | 122 | | |
120 | 123 | | |
121 | | - | |
| 124 | + | |
122 | 125 | | |
123 | 126 | | |
124 | | - | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
125 | 135 | | |
126 | 136 | | |
127 | 137 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
75 | 78 | | |
76 | 79 | | |
77 | 80 | | |
| |||
547 | 550 | | |
548 | 551 | | |
549 | 552 | | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
0 commit comments