Mercurial > trustbridge
diff common/portpath.c @ 170:3343ddf43f42
Windows implementation of port_dirname: strip trailing '/' and '\'.
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Tue, 25 Mar 2014 13:33:27 +0100 |
parents | 701b7036c5dc |
children | 70d627e9e801 |
line wrap: on
line diff
--- 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);