Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
paths.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define O_BINARY   0
 
#define DT_MAX_FILENAME_LEN   256
 
#define DT_PATH_MAX   4096
 Buffer size for a filesystem path anywhere in Ansel.
 
#define DT_MAX_PATH_FOR_PARAMS   4096
 

Functions

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.
 

Macro Definition Documentation

◆ DT_MAX_FILENAME_LEN

#define DT_MAX_FILENAME_LEN   256

define for max path/filename length

Definition at line 35 of file paths.h.

◆ DT_MAX_PATH_FOR_PARAMS

#define DT_MAX_PATH_FOR_PARAMS   4096

Definition at line 65 of file paths.h.

◆ DT_PATH_MAX

#define DT_PATH_MAX   4096

Buffer size for a filesystem path anywhere in Ansel.

This is deliberately NOT the system PATH_MAX. That macro is not a constant across the platforms we ship: 4096 on Linux, 1024 on macOS, and 260 on Windows – mingw's <limits.h> defines it unconditionally, and redefines it to 512 under POSIX, so it even overrides a value we set first.

What used to live here was #ifndef PATH_MAX / #define PATH_MAX 4096, which is dead code on all three platforms, because all three define it. The visible consequence was that every char buf[PATH_MAX] in the tree – including the five path members of dt_image_t – was a 4096-byte buffer when built on Linux and a 260-byte one when built on Windows, where paths under LOCALAPPDATA% get close to that and were silently truncated by the g_strlcpy/snprintf that fill them.

Sizing our own buffers is our decision, so we make it once, here, for every platform. Note this does not by itself let Windows OPEN a path longer than its own MAX_PATH – that needs a long-path-aware manifest – it only stops us truncating before the OS is ever asked.

Definition at line 57 of file paths.h.

◆ O_BINARY

#define O_BINARY   0

Definition at line 24 of file paths.h.

Function Documentation

◆ dt_concat_path_file()

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.

Parameters
destination
variable
string

Definition at line 2683 of file darktable.c.

References DT_PATH_MAX.

Referenced by _database_delete_mipmaps_files(), _database_init(), _database_migrate_to_xdg_structure(), _get_custom_model(), _get_model(), _ls_db(), _noiseprofile_load(), dt_gui_gtk_init(), dt_init(), dt_mipmap_get_cache_filename(), dt_opencl_device_init(), dt_opencl_load_program(), dt_opencl_md5sum(), dt_rawspeed_load_meta(), and dt_styles_save_to_file().