diff options
Diffstat (limited to 'src/path.cc')
-rw-r--r-- | src/path.cc | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/path.cc b/src/path.cc index 3812b87..8be2f26 100644 --- a/src/path.cc +++ b/src/path.cc @@ -26,15 +26,27 @@ */ #include "path.h" +#ifndef WIN32 #include <libgen.h> +#endif + #include <string.h> #include <stdlib.h> std::string getPath(std::string file) { + std::string p; +#ifndef WIN32 char *b = strdup(file.c_str()); - std::string p = dirname(b); + p = dirname(b); free(b); +#else + char drive[_MAX_DRIVE]; + char dir[_MAX_DIR]; + _splitpath(file.c_str(), drive, dir, NULL, NULL); + p = std::string(drive) + dir; +#endif + return p; } |