diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-10-13 10:32:33 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-10-13 10:32:33 -0700 |
commit | 50421f1fa8c6d999d13348a89527df7adcc02fd9 (patch) | |
tree | ba5bfa5d744a4e62fb6392294b65eecb27577484 | |
parent | ec8f2176a7d565ab55c00bebe0f31ae83c368945 (diff) | |
download | subsurface-50421f1fa8c6d999d13348a89527df7adcc02fd9.tar.gz |
Make sure our default path exists (for Linux and Mac)
I'm not sure if this could ever turn into an issue on Windows - but on
Linux and Mac this is an easy and safe thing to do and it avoids a
situation where we try to save the picture hashes without having this
directory.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | linux.c | 3 | ||||
-rw-r--r-- | macos.c | 2 |
2 files changed, 5 insertions, 0 deletions
@@ -3,6 +3,7 @@ #include "dive.h" #include "display.h" #include "membuffer.h" +#include "qthelperfromc.h" #include <string.h> #include <sys/types.h> #include <dirent.h> @@ -63,6 +64,8 @@ static const char *system_default_path_append(const char *append) memset(buffer, 0, len); strcat(buffer, home); strcat(buffer, path); + // make sure this path exists + subsurface_mkdir(buffer); if (append) { strcat(buffer, "/"); strcat(buffer, append); @@ -56,6 +56,8 @@ static const char *system_default_path_append(const char *append) memset(buffer, 0, len); strcat(buffer, home); strcat(buffer, path); + // make sure this path exists + subsurface_mkdir(buffer); if (append) { strcat(buffer, "/"); strcat(buffer, append); |