Refactor logic for finding share/top/ files
authorTeemu Murtola <teemu.murtola@gmail.com>
Thu, 1 Jan 2015 06:28:29 +0000 (08:28 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Thu, 8 Jan 2015 19:00:27 +0000 (20:00 +0100)
commit6dd501c62a2c946378ed7fa3a73492b1180760b5
treebb5ffdc9749be373fc8e630cf535181e3ef2b5eb
parent9a6b6096b0cde23ac42f5d342d96f4a532d8ebcc
Refactor logic for finding share/top/ files

Refactor the logic of how gmxlibfn() finds the library files into a
separate C++ class that provides some support for customization.

By itself, this change only rewrites the existing logic into C++ with a
few minor functional changes:
 - unit tests no longer get confused if GMXLIB is set, and
 - the default data directory is searched even if GMXLIB is set,
   removing the need to duplicate all the files into custom directories
   and/or to manually specify the default directory.
However, it also lays the groundwork for further refactoring:
 - consolidating the other direct use of GMXLIB env.var. from
   fflibutil.cpp into the same place
 - more reusable logic for finding the files, e.g., for JIT compilation
   or for structuring the data files into more than one directory
 - removing one-off uses of functions like low_libopen

Change-Id: I4e14a7e7f11846b3828265c1c735da6bc57f97ff
src/gromacs/commandline/cmdlineinit.cpp
src/gromacs/utility/CMakeLists.txt
src/gromacs/utility/datafilefinder.cpp [new file with mode: 0644]
src/gromacs/utility/datafilefinder.h [new file with mode: 0644]
src/gromacs/utility/file.cpp
src/gromacs/utility/file.h
src/gromacs/utility/futil.cpp
src/gromacs/utility/futil.h
src/testutils/testinit.cpp