(git:b5558c7)
Loading...
Searching...
No Matches
cp_data_dir.c
Go to the documentation of this file.
1/*----------------------------------------------------------------------------*/
2/* CP2K: A general program to perform molecular dynamics simulations */
3/* Copyright 2000-2025 CP2K developers group <https://cp2k.org> */
4/* */
5/* SPDX-License-Identifier: GPL-2.0-or-later */
6/*----------------------------------------------------------------------------*/
7
8#include <stdlib.h>
9
10// Since __DATA_DIR can be arbitrarily long we must not let the preprocessor
11// expand that macro in Fortran code as it could exceed the line length limit.
12static const char *data_dir = __DATA_DIR;
13
14/*******************************************************************************
15 * \brief Returns path of data directory if set, otherwise an empty string.
16 * \author Ole Schuett
17 ******************************************************************************/
18const char *get_data_dir() {
19 const char *overwrite = getenv("CP2K_DATA_DIR");
20 if (overwrite != NULL) {
21 return overwrite;
22 }
23 return data_dir;
24}
25
26// EOF
static const char * data_dir
Definition cp_data_dir.c:12
const char * get_data_dir()
Returns path of data directory if set, otherwise an empty string.
Definition cp_data_dir.c:18