Skip to content

Commit

Permalink
Fixing windows bug where C:/ slash may already be normalized
Browse files Browse the repository at this point in the history
  • Loading branch information
weaverryan committed Feb 27, 2018
1 parent 20df636 commit abbe8d9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/FileManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ public function absolutizePath($path): string
return $path;
}

// support windows drive paths: C:\
if (1 === strpos($path, ':\\')) {
// support windows drive paths: C:\ or C:/
if (1 === strpos($path, ':\\') || 1 === strpos($path, ':/')) {
return $path;
}

Expand Down
6 changes: 6 additions & 0 deletions tests/FileManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,11 @@ public function getAbsolutePathTests()
'D:\foo\bar',
'D:\foo\bar',
];

yield 'windows_already_absolute_path' => [
'D:\path\to\project',
'D:/foo/bar',
'D:/foo/bar',
];
}
}

0 comments on commit abbe8d9

Please sign in to comment.