LCOV - code coverage report
Current view: top level - src/common - cp_data_dir.c (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:3a1353c) Lines: 100.0 % 4 4
Test Date: 2025-12-05 06:41:32 Functions: 100.0 % 1 1

            Line data    Source code
       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.
      12              : static 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              :  ******************************************************************************/
      18        18894 : const char *get_data_dir() {
      19        18894 :   const char *overwrite = getenv("CP2K_DATA_DIR");
      20        18894 :   if (overwrite != NULL) {
      21              :     return overwrite;
      22              :   }
      23        18894 :   return data_dir;
      24              : }
      25              : 
      26              : // EOF
        

Generated by: LCOV version 2.0-1