Skip to content

Commit c8d859b

Browse files
committed
handle Windows absolute paths in #518
recognize C:\-style paths as absolute on Windows
1 parent 21d54a2 commit c8d859b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/path.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,17 @@ std::string Path::from_dir(const std::string& dir, const std::string& path)
5454
{
5555
// C++17's std::filesystem::path may be used to implement our Path if present
5656

57+
#ifdef OS_WIN
58+
char drive;
59+
60+
drive = path.front();
61+
if (path.length() >= 2 &&
62+
path[1] == ':' &&
63+
((drive >= 'A' && drive <= 'Z') ||
64+
(drive >= 'a' && drive <= 'z')))
65+
#else
5766
if (path.front() == PATHSEPCHR)
67+
#endif
5868
return path;
5969

6070
std::string fullpath;

0 commit comments

Comments
 (0)