# HG changeset patch # User Sascha Wilde # Date 1395750807 -3600 # Node ID 3343ddf43f421df96171675955835265eed4252c # Parent 701b7036c5dcdab352379c75ecfd47e6f9930bcf Windows implementation of port_dirname: strip trailing '/' and '\'. diff -r 701b7036c5dc -r 3343ddf43f42 common/portpath.c --- a/common/portpath.c Tue Mar 25 13:20:23 2014 +0100 +++ b/common/portpath.c Tue Mar 25 13:33:27 2014 +0100 @@ -18,6 +18,10 @@ char drive[_MAX_DRIVE]; char dir[_MAX_DIR]; _splitpath(path, drive, dir, NULL, NULL); + size_t dlen = strlen(dir); + if ((dlen > 0) && + ((dir[dlen-1] == '/') || (dir[dlen-1] == '\\'))) + dir[dlen-1] = '\0'; /* We assume: drive + dir is shorter than * drive + dir + fname + ext */ sprintf(path, "%s%s", drive, dir);