Fix issue with path striping
This commit is contained in:
parent
4f55e9e9bc
commit
8eda2146d9
|
@ -16,7 +16,7 @@
|
||||||
#define fileno(x) _fileno(x)
|
#define fileno(x) _fileno(x)
|
||||||
#define mkdir(x) _mkdir(x)
|
#define mkdir(x) _mkdir(x)
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
#define PATHSEP '\\'
|
#define PATHSEP '/\\'
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
@ -45,16 +45,11 @@ namespace {
|
||||||
|
|
||||||
std::size_t pos;
|
std::size_t pos;
|
||||||
// '/' can be used on most platforms (even windows)
|
// '/' can be used on most platforms (even windows)
|
||||||
pos = dir.find_last_of('/');
|
|
||||||
if (pos != dir.npos) {
|
|
||||||
dir = dir.substr(0,pos + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// strip platform specific as well
|
|
||||||
pos = dir.find_last_of(PATHSEP);
|
pos = dir.find_last_of(PATHSEP);
|
||||||
if (pos != dir.npos) {
|
if (pos != dir.npos) {
|
||||||
dir = dir.substr(0,pos + 1);
|
dir = dir.substr(0,pos + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dir == filename) {
|
if(dir == filename) {
|
||||||
dir = "";
|
dir = "";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue