Skip to content

Commit

Permalink
Change way we test for Windows drive letters
Browse files Browse the repository at this point in the history
  • Loading branch information
thekid committed Jun 10, 2017
1 parent 2093ae2 commit 6023652
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/php/io/Path.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ public function asFolder(bool $existing= false): Folder {
* it only removes redundant elements.
*/
public function normalize(): self {
if (2 === sscanf($this->path, '%c%*[:]', $drive)) {
if (strlen($this->path) > 1 && ':' === $this->path{1}) {
$components= explode(DIRECTORY_SEPARATOR, substr($this->path, 3));
$normalized= [strtoupper($drive).':'];
$normalized= [strtoupper($this->path{0}).':'];
} else {
$components= explode(DIRECTORY_SEPARATOR, $this->path);
$normalized= [];
Expand Down

0 comments on commit 6023652

Please sign in to comment.