From cc21f1b538abac3d4bad612563454a910e4c2136 Mon Sep 17 00:00:00 2001 From: Benjamin Schaaf Date: Tue, 5 Jan 2021 16:52:15 +1100 Subject: [PATCH] Use XDG special directory instead of hard-coding ~/Pictures Fixes #22 --- main.c | 2 +- process_pipeline.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 558bb4d..4340454 100644 --- a/main.c +++ b/main.c @@ -346,7 +346,7 @@ on_open_directory_clicked(GtkWidget *widget, gpointer user_data) { char uri[270]; GError *error = NULL; - sprintf(uri, "file://%s/Pictures", getenv("HOME")); + sprintf(uri, "file://%s", g_get_user_special_dir(G_USER_DIRECTORY_PICTURES)); if (!g_app_info_launch_default_for_uri(uri, NULL, &error)) { g_printerr("Could not launch image viewer: %s\n", error->message); } diff --git a/process_pipeline.c b/process_pipeline.c index de8416c..fa82983 100644 --- a/process_pipeline.c +++ b/process_pipeline.c @@ -350,7 +350,10 @@ process_capture_burst(cairo_surface_t *thumb) char timestamp[30]; strftime(timestamp, 30, "%Y%m%d%H%M%S", &tim); - sprintf(capture_fname, "%s/Pictures/IMG%s", getenv("HOME"), timestamp); + sprintf(capture_fname, + "%s/IMG%s", + g_get_user_special_dir(G_USER_DIRECTORY_PICTURES), + timestamp); // Start post-processing the captured burst g_print("Post process %s to %s.ext\n", burst_dir, capture_fname);