1 Return-Path: <bijan.chokoufe@gmail.com>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by arlo.cworth.org (Postfix) with ESMTP id 8FF0B6DE00EB
\r
6 for <notmuch@notmuchmail.org>; Sun, 8 May 2016 08:50:06 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
11 X-Spam-Status: No, score=-0.47 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
\r
13 FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001,
\r
14 HEADER_FROM_DIFFERENT_DOMAINS=0.001, RCVD_IN_DNSWL_LOW=-0.7,
\r
15 RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001]
\r
17 Received: from arlo.cworth.org ([127.0.0.1])
\r
18 by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)
\r
19 with ESMTP id IrETlqkOY2w4 for <notmuch@notmuchmail.org>;
\r
20 Sun, 8 May 2016 08:49:57 -0700 (PDT)
\r
21 Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com
\r
22 [74.125.82.66]) by arlo.cworth.org (Postfix) with ESMTPS id CAAA56DE0022 for
\r
23 <notmuch@notmuchmail.org>; Sun, 8 May 2016 08:49:56 -0700 (PDT)
\r
24 Received: by mail-wm0-f66.google.com with SMTP id w143so16747169wmw.3
\r
25 for <notmuch@notmuchmail.org>; Sun, 08 May 2016 08:49:56 -0700 (PDT)
\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
\r
27 h=sender:from:to:cc:subject:date:message-id;
\r
28 bh=Ul8eytKlozsYZyVbm9I2bHygmkFi2wYK7vsUqwQW7Js=;
\r
29 b=o9QU/3dq92/SR3DGHKBh/eDxZ/iiZ3qGVEEngbSVFBfc1t2TYAQDM1i74sKZKxluLl
\r
30 rQA7jEvPcs6R4AVohwVpMGfpg+69tpySZHgkz4Vv2zTQN5blshfBNfY0jW8Z/YSCbOYK
\r
31 ZEtVCjoZsOnnjkno1Y4um6IiepUVW/VCfxLX5aD81muAbSSLOgt4RykGBxL/DcqtdHZl
\r
32 FFa+KGxU2OeT8z4E7AO3k9jkB3UjkA3cP8kuOuh67NS43ri/VRYuan8h9HvUJ4KQZmtJ
\r
33 lJ2zIKUjwtNllK58TFRYzaB+YfdbXooE9n32N90CDVjFKP7oahxOHlRWRVwETl1enP/J
\r
35 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
36 d=1e100.net; s=20130820;
\r
37 h=x-gm-message-state:sender:from:to:cc:subject:date:message-id;
\r
38 bh=Ul8eytKlozsYZyVbm9I2bHygmkFi2wYK7vsUqwQW7Js=;
\r
39 b=VX+kMVnnmXsLk3nXnu+m/4mnU0eqLi5colL4cnEdPi+/qxsKQkeDTnYEqcf3zBmYyU
\r
40 VBLKnA+lHJGvZWlabKYtARoX9Z0wXs8iRe4c/PrhJYkTv79vUGw1kpuyJzgNdT47uEmM
\r
41 6lI6z7u2ZknsooBL6+LMVLmmEYLd06VHaJHKPQM6uUyLOA64rvMw8P5I4VPbLUXd6Ho8
\r
42 OvKXMWImUXK4DyHoqTo90oZp7k3NYcWi+uxsTMq35xxc5oD+yHuXfRlKOl/mLrurjhJV
\r
43 OFO+GJfaW+joTwT1H2t/yB7S5QxvyvWfxt7ovMOSTCObYJa5xF9jMUJgcXtyGLHLqWpN
\r
46 AOPr4FWtjrBA7z5CZyLMt1iZfSWFEr7zTQambNnAzQoFGL9Blp4NMp2hpKJ0kGgeKfxlOA==
\r
47 X-Received: by 10.194.114.100 with SMTP id jf4mr28087233wjb.55.1462722595025;
\r
48 Sun, 08 May 2016 08:49:55 -0700 (PDT)
\r
49 Received: from localhost.localdomain (ip5f5be327.dynamic.kabel-deutschland.de.
\r
51 by smtp.gmail.com with ESMTPSA id lr9sm8040308wjb.39.2016.05.08.08.49.53
\r
52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);
\r
53 Sun, 08 May 2016 08:49:54 -0700 (PDT)
\r
54 Sender: Bijan Chokoufe <bijan.chokoufe@gmail.com>
\r
55 From: Bijan Chokoufe Nejad <bijan@chokoufe.com>
\r
56 To: notmuch@notmuchmail.org
\r
57 Subject: [PATCH] config: Expand ~ to $HOME
\r
58 Date: Sun, 8 May 2016 17:49:34 +0200
\r
59 Message-Id: <1462722574-4176-1-git-send-email-bijan@chokoufe.com>
\r
60 X-Mailer: git-send-email 1.9.1
\r
61 X-BeenThere: notmuch@notmuchmail.org
\r
62 X-Mailman-Version: 2.1.20
\r
64 List-Id: "Use and development of the notmuch mail system."
\r
65 <notmuch.notmuchmail.org>
\r
66 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,
\r
67 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
68 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
69 List-Post: <mailto:notmuch@notmuchmail.org>
\r
70 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
71 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,
\r
72 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
73 X-List-Received-Date: Sun, 08 May 2016 15:50:06 -0000
\r
75 Very useful in case you want to keep your .notmuch-config synchronized across
\r
76 machines where you have different user names.
\r
78 Not sure this is completely plattform independent.
\r
79 I also don't know how to implement a unit test for this.
\r
81 notmuch-config.c | 11 ++++++++++-
\r
82 1 file changed, 10 insertions(+), 1 deletion(-)
\r
84 diff --git a/notmuch-config.c b/notmuch-config.c
\r
85 index d252bb2..c9f26ef 100644
\r
86 --- a/notmuch-config.c
\r
87 +++ b/notmuch-config.c
\r
88 @@ -605,7 +605,16 @@ _config_set_list (notmuch_config_t *config,
\r
90 notmuch_config_get_database_path (notmuch_config_t *config)
\r
92 - return _config_get (config, &config->database_path, "database", "path");
\r
93 + const char* path = _config_get (config, &config->database_path, "database", "path");
\r
94 + if (path != NULL && path[0] == '~') {
\r
95 + char *home_path = getenv("HOME");
\r
96 + char *shortened_path = malloc( sizeof(char) * ( strlen (path) - 1 ) );
\r
97 + strncpy(shortened_path, path + 2, strlen(path));
\r
98 + return talloc_asprintf (NULL, "%s/%s", home_path, shortened_path);
\r