summaryrefslogtreecommitdiff
path: root/libgphoto2
diff options
context:
space:
mode:
authorpeterbud <peterbudai@hotmail.com>2016-11-19 23:53:03 +0100
committerMarcus Meissner <marcus@jet.franken.de>2016-11-20 00:06:06 +0100
commit7c445e08dc70ec42af59ecb271485348075d203f (patch)
treee38d61bcbd2311ecc9747796eee2a479c4807b3e /libgphoto2
parent7f00f3ba2267597c560e1b5a9416574414ec828f (diff)
downloadlibgphoto2-7c445e08dc70ec42af59ecb271485348075d203f.tar.gz
store the settings on windows in CSIDL_PROFILE/.gphoto and not
in the windows directory anymore
Diffstat (limited to 'libgphoto2')
-rw-r--r--libgphoto2/gphoto2-setting.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/libgphoto2/gphoto2-setting.c b/libgphoto2/gphoto2-setting.c
index 73a74f935..69202e4ef 100644
--- a/libgphoto2/gphoto2-setting.c
+++ b/libgphoto2/gphoto2-setting.c
@@ -21,7 +21,7 @@
* Boston, MA 02110-1301 USA
*/
-#define _BSD_SOURCE
+#define _DEFAULT_SOURCE
#include "config.h"
#include <gphoto2/gphoto2-setting.h>
@@ -34,6 +34,10 @@
#include <gphoto2/gphoto2-port-log.h>
#include <gphoto2/gphoto2-port-portability.h>
+#ifdef WIN32
+#include <Shlobj.h>
+#endif
+
/**
* Internal struct to store settings.
*/
@@ -169,8 +173,8 @@ load_settings (void)
/* Make sure the directories are created */
#ifdef WIN32
- GetWindowsDirectory (buf, sizeof(buf));
- strcat (buf, "\\gphoto");
+ SHGetFolderPath(NULL, CSIDL_PROFILE, NULL, 0, buf);
+ strcat (buf, "\\.gphoto");
#else
snprintf (buf, sizeof(buf), "%s/.gphoto", getenv ("HOME"));
#endif
@@ -179,8 +183,8 @@ load_settings (void)
glob_setting_count = 0;
#ifdef WIN32
- GetWindowsDirectory(buf, sizeof(buf));
- strcat(buf, "\\gphoto\\settings");
+ SHGetFolderPath(NULL, CSIDL_PROFILE, NULL, 0, buf);
+ strcat(buf, "\\.gphoto\\settings");
#else
snprintf(buf, sizeof(buf), "%s/.gphoto/settings", getenv("HOME"));
#endif
@@ -225,7 +229,13 @@ save_settings (void)
char buf[1024];
int x=0;
+#ifdef WIN32
+ SHGetFolderPath(NULL, CSIDL_PROFILE, NULL, 0, buf);
+ strcat(buf, "\\.gphoto\\settings");
+#else
snprintf (buf, sizeof(buf), "%s/.gphoto/settings", getenv ("HOME"));
+#endif
+
GP_LOG_D ("Saving %i setting(s) to file \"%s\"", glob_setting_count, buf);