comparison 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
comparison
equal deleted inserted replaced
169:701b7036c5dc 170:3343ddf43f42
16 return dirname(path); 16 return dirname(path);
17 #else 17 #else
18 char drive[_MAX_DRIVE]; 18 char drive[_MAX_DRIVE];
19 char dir[_MAX_DIR]; 19 char dir[_MAX_DIR];
20 _splitpath(path, drive, dir, NULL, NULL); 20 _splitpath(path, drive, dir, NULL, NULL);
21 size_t dlen = strlen(dir);
22 if ((dlen > 0) &&
23 ((dir[dlen-1] == '/') || (dir[dlen-1] == '\\')))
24 dir[dlen-1] = '\0';
21 /* We assume: drive + dir is shorter than 25 /* We assume: drive + dir is shorter than
22 * drive + dir + fname + ext */ 26 * drive + dir + fname + ext */
23 sprintf(path, "%s%s", drive, dir); 27 sprintf(path, "%s%s", drive, dir);
24 return path; 28 return path;
25 #endif 29 #endif

http://wald.intevation.org/projects/trustbridge/