]> git.proxmox.com Git - libgit2.git/commit - src/path.c
path: get correct dirname for Windows root
authorPatrick Steinhardt <ps@pks.im>
Tue, 7 Feb 2017 19:30:11 +0000 (20:30 +0100)
committerPatrick Steinhardt <ps@pks.im>
Wed, 8 Feb 2017 11:03:49 +0000 (12:03 +0100)
commit5d59520ccd4816080e68b5a3057653c15f3d6816
tree9890bf77b2136b73034e8a731354cbbc20309917
parentd8c06070a87ced23712eaa2b55a0cebb148f9f9a
path: get correct dirname for Windows root

Getting the dirname of a filesystem root should return the filesystem
root itself. E.g. the dirname of "/" is always "/". On Windows, we
emulate this behavior and as such, we should return e.g. "C:/" if
calling dirname on "C:/". But we currently fail to do so and instead
return ".", as we do not check if we actually have a Windows prefix
before stripping off the last directory component.

Fix this by calling out to `win32_prefix_length` immediately after
stripping trailing slashes, returning early if we have a prefix.
src/path.c
tests/core/path.c