Authentication-Results: mail-b.sr.ht; dkim=pass header.d=kpnmail.nl header.i=@kpnmail.nl Received: from cpsmtpb-ews04.kpnxchange.com (cpsmtpb-ews04.kpnxchange.com [213.75.39.7]) by mail-b.sr.ht (Postfix) with ESMTP id E244F11EFF8 for <~martijnbraam/public-inbox@lists.sr.ht>; Tue, 23 Feb 2021 19:44:02 +0000 (UTC) Received: from cpsps-ews03.kpnxchange.com ([10.94.84.170]) by cpsmtpb-ews04.kpnxchange.com with Microsoft SMTPSVC(8.5.9600.16384); Tue, 23 Feb 2021 20:44:01 +0100 X-Brand: 4ZrJ X-KPN-SpamVerdict: e1=0;e2=0;e3=0;e4=;e6=(e1=10;e3=10;e2=11;e4=10;e6=1 0);EVW:White;BM:NotScanned;FinalVerdict:Clean X-CMAE-Analysis: v=2.4 cv=E/yuGYRl c=1 sm=1 tr=0 ts=60355b01 cx=a_idp_e a=LO2mTXPAMClkaqVt2RTykg==:117 a=91EcYerEhEQM9exFoehDzA==:17 a=wpcR9ptUiwUA:10 a=qa6Q16uM49sA:10 a=bwGbKnmsAAAA:8 a=gs6WmJpP0l1vOCGu_GkA:9 a=EJZK8FK7wl9iWZ4t:21 a=rvHyBEbPmi8Nn2Ql:21 a=nuVVIWbBudwLbAahYuja:22 X-CM-AcctID: kpn@feedback.cloudmark.com Received: from smtp.kpnmail.nl ([195.121.84.12]) by cpsps-ews03.kpnxchange.com over TLS secured channel with Microsoft SMTPSVC(8.5.9600.16384); Tue, 23 Feb 2021 20:44:01 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kpnmail.nl; s=kpnmail01; h=mime-version:message-id:date:subject:to:from; bh=F42sdvuUBrT4R9WWra9ZVC3ig+TN+ZhVzBWGUQiwH/I=; b=ZS/VDiEUdPIahEhlQJU1Ha2Laeicyh54SoROm6nljx6HPHlr6P1nYz5z70cZ5BE6U5mOD/JkDKASt jPvrOAc+GdIEFc4sweIrRBR4IW2cBbkAaju/TJALuRjsBU0ALVYVCt0HI5PUGEunzcZuXYc2lqb3uM gINm5o5W6rt/HWDU= X-Originating-IP: 77.161.34.157 Received: from mail.anaproy.nl (77-161-34-157.fixed.kpn.net [77.161.34.157]) by smtp.kpnmail.nl (Halon) with ESMTP id 7a8a182f-760f-11eb-8b64-00505699772e; Tue, 23 Feb 2021 20:44:01 +0100 (CET) Received: from mail.anaproy.nl (localhost [127.0.0.1]) by mail.anaproy.nl (Postfix) with ESMTP id 7C366126E2 for <~martijnbraam/public-inbox@lists.sr.ht>; Tue, 23 Feb 2021 20:44:01 +0100 (CET) Received: by mail.anaproy.nl (Postfix, from userid 10067) id 53211126E1; Tue, 23 Feb 2021 20:44:01 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mailserver.anaproy.lxd X-Spam-Level: X-Spam-Status: No, hits=-2.9 required=4.0 tests=ALL_TRUSTED=-1,BAYES_00=-1.9 autolearn=unavailable autolearn_force=no X-Spam-Details: version=3.4.2 * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from rocinante.anaproy.nl (unknown [192.168.3.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: proycon) by mail.anaproy.nl (Postfix) with ESMTPSA id B272B12659; Tue, 23 Feb 2021 20:43:59 +0100 (CET) From: Maarten van Gompel To: ~martijnbraam/public-inbox@lists.sr.ht Cc: Maarten van Gompel Subject: [PATCH Megapixels] Implementing fallbacks when special dirs don't behave as expected #44 Date: Tue, 23 Feb 2021 20:42:40 +0100 Message-Id: <20210223194239.4025948-1-proycon@anaproy.nl> X-Mailer: git-send-email 2.30.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP X-OriginalArrivalTime: 23 Feb 2021 19:44:01.0639 (UTC) FILETIME=[3C381770:01D70A1C] X-RcptDomain: lists.sr.ht This solves https://todo.sr.ht/~martijnbraam/Megapixels/44 , seems need in sxmo (at least for me). --- process_pipeline.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/process_pipeline.c b/process_pipeline.c index 4ba2f99..017089d 100644 --- a/process_pipeline.c +++ b/process_pipeline.c @@ -357,10 +357,23 @@ process_capture_burst(cairo_surface_t *thumb) char timestamp[30]; strftime(timestamp, 30, "%Y%m%d%H%M%S", &tim); - sprintf(capture_fname, - "%s/IMG%s", - g_get_user_special_dir(G_USER_DIRECTORY_PICTURES), - timestamp); + if (g_get_user_special_dir(G_USER_DIRECTORY_PICTURES) != NULL) { + sprintf(capture_fname, + "%s/IMG%s", + g_get_user_special_dir(G_USER_DIRECTORY_PICTURES), + timestamp); + } else if (getenv("XDG_PICTURES_DIR") != NULL) { + sprintf(capture_fname, + "%s/IMG%s", + getenv("XDG_PICTURES_DIR"), + timestamp); + } else { + sprintf(capture_fname, + "%s/Pictures/IMG%s", + getenv("HOME"), + timestamp); + } + // Start post-processing the captured burst g_print("Post process %s to %s.ext\n", burst_dir, capture_fname); -- 2.30.1