summaryrefslogtreecommitdiff
path: root/src/path.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2016-04-16 13:33:53 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2016-04-16 13:33:53 +0200
commit4eb252df04ab237c8638d45bcbf028859dc6a110 (patch)
tree8bffddf62b4271336a6e0121fef8133327654000 /src/path.cc
parentef68248bf70a027595803b08433a7a2c74e20fd0 (diff)
parent35e804b984c28131fe13d229c5a0867762c6e8cf (diff)
Merge branch 'settings'
Diffstat (limited to 'src/path.cc')
-rw-r--r--src/path.cc18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/path.cc b/src/path.cc
index 43c64f0..c2e7910 100644
--- a/src/path.cc
+++ b/src/path.cc
@@ -35,17 +35,19 @@
std::string getPath(const std::string& file)
{
- std::string p;
-#ifndef __MINGW32__
- char *b = strdup(file.c_str());
- p = dirname(b);
- free(b);
-#else
+ std::string path;
+
+#ifdef __MINGW32__
char drive[_MAX_DRIVE];
char dir[_MAX_DIR];
_splitpath(file.c_str(), drive, dir, NULL, NULL);
- p = std::string(drive) + dir;
+ path = std::string(drive) + dir;
+#else
+ // POSIX
+ char* buffer = strdup(file.c_str());
+ path = dirname(buffer);
+ free(buffer);
#endif
- return p;
+ return path;
}