Skip to content

Commit 6023652

Browse files
committed
Change way we test for Windows drive letters
See #176 (comment)
1 parent 2093ae2 commit 6023652

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/php/io/Path.class.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,9 @@ public function asFolder(bool $existing= false): Folder {
228228
* it only removes redundant elements.
229229
*/
230230
public function normalize(): self {
231-
if (2 === sscanf($this->path, '%c%*[:]', $drive)) {
231+
if (strlen($this->path) > 1 && ':' === $this->path{1}) {
232232
$components= explode(DIRECTORY_SEPARATOR, substr($this->path, 3));
233-
$normalized= [strtoupper($drive).':'];
233+
$normalized= [strtoupper($this->path{0}).':'];
234234
} else {
235235
$components= explode(DIRECTORY_SEPARATOR, $this->path);
236236
$normalized= [];

0 commit comments

Comments
 (0)