unix: change uv_cwd not to return a trailing slash
This aligns the behavior with the Windows implementation. PR-URL: https://github.com/libuv/libuv/pull/63 Reviewed-By: Bert Belder <bertbelder@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
parent
eb986397c1
commit
d4d1f32858
@ -207,6 +207,10 @@ API
|
||||
|
||||
Gets the current working directory.
|
||||
|
||||
.. versionchanged:: 1.1.0
|
||||
|
||||
On Unix the path no longer ends in a slash.
|
||||
|
||||
.. c:function:: int uv_chdir(const char* dir)
|
||||
|
||||
Changes the current working directory.
|
||||
|
||||
@ -635,6 +635,11 @@ int uv_cwd(char* buffer, size_t* size) {
|
||||
return -errno;
|
||||
|
||||
*size = strlen(buffer);
|
||||
if (*size > 1 && buffer[*size - 1] == '/') {
|
||||
buffer[*size-1] = '\0';
|
||||
(*size)--;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user