Line data Source code
1 : /*----------------------------------------------------------------------------*/
2 : /* CP2K: A general program to perform molecular dynamics simulations */
3 : /* Copyright 2000-2026 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.
12 : static const char *data_dir = __DATA_DIR;
13 : static const char *compile_dir = __COMPILE_DIR;
14 :
15 : /*******************************************************************************
16 : * \brief Returns path of data directory if set, otherwise an empty string.
17 : * \author Ole Schuett
18 : ******************************************************************************/
19 22785 : const char *get_data_dir() {
20 22785 : const char *overwrite = getenv("CP2K_DATA_DIR");
21 22785 : if (overwrite != NULL) {
22 : return overwrite;
23 : }
24 0 : return data_dir;
25 : }
26 :
27 : /*******************************************************************************
28 : * \brief Returns the build directory.
29 : ******************************************************************************/
30 6002 : const char *get_compile_dir() { return compile_dir; }
31 :
32 : // EOF
|