File tree 1 file changed +18
-2
lines changed
1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -135,12 +135,28 @@ pub fn split_windows(path: String) -> List(String) {
135
135
}
136
136
}
137
137
138
+ const codepoint_slash = 47
139
+
140
+ const codepoint_backslash = 92
141
+
142
+ const codepoint_colon = 58
143
+
144
+ const codepoint_a = 65
145
+
146
+ const codepoint_z = 90
147
+
148
+ const codepoint_a_up = 97
149
+
150
+ const codepoint_z_up = 122
151
+
138
152
fn pop_windows_drive_specifier ( path : String ) -> # ( Option ( String ) , String ) {
139
153
let start = string . slice ( from : path , at_index : 0 , length : 3 )
140
154
let codepoints = string . to_utf_codepoints ( start )
141
155
case list . map ( codepoints , string . utf_codepoint_to_int ) {
142
- [ drive , colon , slash ] if { slash == 47 || slash == 92 } && colon == 58 && {
143
- drive >= 65 && drive <= 90 || drive >= 97 && drive <= 122
156
+ [ drive , colon , slash ] if {
157
+ slash == codepoint_slash || slash == codepoint_backslash
158
+ } && colon == codepoint_colon && {
159
+ drive >= codepoint_a && drive <= codepoint_z || drive >= codepoint_a_up && drive <= codepoint_z_up
144
160
} -> {
145
161
let drive_letter = string . slice ( from : path , at_index : 0 , length : 1 )
146
162
let drive = string . lowercase ( drive_letter ) <> ":/"
You can’t perform that action at this time.
0 commit comments