]> git.notmuchmail.org Git - notmuch/blob - util/path-util.c
emacs: Add new option notmuch-search-hide-excluded
[notmuch] / util / path-util.c
1 /*
2  * SPDX-License-Identifier: GPL-3.0-or-later
3  */
4
5 #define _GNU_SOURCE
6
7 #include "path-util.h"
8
9 #include <limits.h>
10 #include <stdlib.h>
11
12
13 char *
14 notmuch_canonicalize_file_name (const char *path)
15 {
16 #if HAVE_CANONICALIZE_FILE_NAME
17     return canonicalize_file_name (path);
18 #elif defined(PATH_MAX)
19     char *resolved_path =  malloc (PATH_MAX + 1);
20     if (resolved_path == NULL)
21         return NULL;
22
23     return realpath (path, resolved_path);
24 #else
25 #error undefined PATH_MAX _and_ missing canonicalize_file_name not supported
26 #endif
27 }