mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-08 07:26:16 +00:00
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>
This commit is contained in:
parent
ec8f2176a7
commit
50421f1fa8
2 changed files with 5 additions and 0 deletions
3
linux.c
3
linux.c
|
@ -3,6 +3,7 @@
|
||||||
#include "dive.h"
|
#include "dive.h"
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
#include "membuffer.h"
|
#include "membuffer.h"
|
||||||
|
#include "qthelperfromc.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
@ -63,6 +64,8 @@ static const char *system_default_path_append(const char *append)
|
||||||
memset(buffer, 0, len);
|
memset(buffer, 0, len);
|
||||||
strcat(buffer, home);
|
strcat(buffer, home);
|
||||||
strcat(buffer, path);
|
strcat(buffer, path);
|
||||||
|
// make sure this path exists
|
||||||
|
subsurface_mkdir(buffer);
|
||||||
if (append) {
|
if (append) {
|
||||||
strcat(buffer, "/");
|
strcat(buffer, "/");
|
||||||
strcat(buffer, append);
|
strcat(buffer, append);
|
||||||
|
|
2
macos.c
2
macos.c
|
@ -56,6 +56,8 @@ static const char *system_default_path_append(const char *append)
|
||||||
memset(buffer, 0, len);
|
memset(buffer, 0, len);
|
||||||
strcat(buffer, home);
|
strcat(buffer, home);
|
||||||
strcat(buffer, path);
|
strcat(buffer, path);
|
||||||
|
// make sure this path exists
|
||||||
|
subsurface_mkdir(buffer);
|
||||||
if (append) {
|
if (append) {
|
||||||
strcat(buffer, "/");
|
strcat(buffer, "/");
|
||||||
strcat(buffer, append);
|
strcat(buffer, append);
|
||||||
|
|
Loading…
Add table
Reference in a new issue