Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
paths.h
Go to the documentation of this file.
1/*
2 This file is part of Ansel,
3 Copyright (C) 2026 Aurélien PIERRE.
4
5 Ansel is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 Ansel is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with Ansel. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef DT_COMMON_PATHS_H
19#define DT_COMMON_PATHS_H
20
21/* g_open() takes O_BINARY on Windows and does not define it elsewhere. Kept here rather
22 * than in darktable.h so that opening a file does not require the application. */
23#if !defined(O_BINARY)
24#define O_BINARY 0
25#endif
26
27/* Path/filename length constants and path splicing. Application-free on purpose:
28 * include this instead of darktable.h. */
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
35#define DT_MAX_FILENAME_LEN 256
36
37#ifndef PATH_MAX
38/*
39 * from /usr/include/linux/limits.h (Linux 3.16.5)
40 * Some systems might not define it (e.g. Hurd)
41 *
42 * We do NOT depend on any specific value of this env variable.
43 * If you want constant value across all systems, use DT_MAX_PATH_FOR_PARAMS!
44 */
45#define PATH_MAX 4096
46#endif
47
48/*
49 * ONLY TO BE USED FOR PARAMS!!! (e.g. dt_imageio_disk_t)
50 *
51 * WARNING: this should *NEVER* be changed, as it will break params,
52 * created with previous DT_MAX_PATH_FOR_PARAMS.
53 */
54#define DT_MAX_PATH_FOR_PARAMS 4096
55
64void dt_concat_path_file(char destination[PATH_MAX], const char path[PATH_MAX], const char *const file);
65
66#ifdef __cplusplus
67}
68#endif
69
70#endif // DT_COMMON_PATHS_H
71
72// clang-format off
73// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
74// vim: shiftwidth=2 expandtab tabstop=2 cindent
75// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
76// clang-format on
void dt_concat_path_file(char destination[4096], const char path[4096], const char *const file)
Append a constant filename to a variable, stack-based, fixed-sized, directory, and add a / in-between...
#define PATH_MAX
Definition paths.h:45