aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2018-11-20 14:59:18 (GMT)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-11-20 16:11:44 (GMT)
commitc85f23b2c4956ef90aa0785264232b8b62029692 (patch)
treef780f18ca7a3324e7a1c58a11a2d7bb65125db7a
parent8eb7a321e697027df08e5d634bc6a53683ed913f (diff)
Fix "Could not create directory '~/Webcam_Pictures'." errorHEADmaster
Fix the "Could not create directory '~/Webcam_Pictures'." error which gets thrown when pressing the "Take Picture" button. The save-dir gsetting default value is '~/Webcam_Pictures', modify the code reading this setting to correctly replace the ~ with $HOME. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
-rw-r--r--src/main.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 913669c..978876b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -208,6 +208,12 @@ static void activate(GtkApplication *app)
#pragma GCC diagnostic pop
cam->pixdir = g_settings_get_string(cam->gc, CAM_SETTINGS_SAVE_DIR);
+ /* Deal with the save-dir default value starting with "~/" */
+ if (cam->pixdir && cam->pixdir[0] == '~' && cam->pixdir[1] == '/') {
+ gchar *old = cam->pixdir;
+ cam->pixdir = g_strdup_printf("%s/%s", g_get_home_dir(), old + 2);
+ g_free(old);
+ }
cam->capturefile = g_settings_get_string(cam->gc, CAM_SETTINGS_SAVE_FILE);
cam->savetype = g_settings_get_int(cam->gc, CAM_SETTINGS_FILE_TYPE);
cam->host = g_settings_get_string(cam->gc, CAM_SETTINGS_HOSTNAME);

Privacy Policy