utils: Return plain drive letter as base/pathname for drive letters on Windows
This commit is contained in:
@@ -241,6 +241,15 @@ char* path_dirname(const char *path)
|
|||||||
}
|
}
|
||||||
if (!pos)
|
if (!pos)
|
||||||
{
|
{
|
||||||
|
#ifdef WIN32
|
||||||
|
if (path && strlen(path))
|
||||||
|
{
|
||||||
|
if ((isalpha(path[0]) && path[1] == ':'))
|
||||||
|
{ /* if just a drive letter given, return that as dirname */
|
||||||
|
return chunk_clone(chunk_from_chars(path[0], ':', 0)).ptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return strdup(".");
|
return strdup(".");
|
||||||
}
|
}
|
||||||
while (pos > path && *pos == DIRECTORY_SEPARATOR[0])
|
while (pos > path && *pos == DIRECTORY_SEPARATOR[0])
|
||||||
|
|||||||
Reference in New Issue
Block a user