Move default library path search to program context
authorTeemu Murtola <teemu.murtola@gmail.com>
Sun, 12 Jan 2014 18:37:08 +0000 (20:37 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Sat, 1 Mar 2014 16:47:04 +0000 (17:47 +0100)
commit1cd25c479eb0326b8c57873b2e0af57f476f9b28
tree5d694ce79789fc9ef6265491d008c47fa8c5af20
parentc2a7c40d4b639d178578003c11cff6badb230f44
Move default library path search to program context

The default library path search is now implemented in
CommandLineProgramContext, and accessible through the generic interface.
This provides the following benefits:
 - All the magic for finding stuff from the binary path is in a single
   place, under the commandline/ module, where it belongs.
 - Code using the library path is now in C++, fixing some potential
   buffer overruns and removing the need for some utility code.
 - Programs using the Gromacs library can customize how the library data
   files are found.
 - PATH_SEPARATOR is no longer exposed outside path.cpp, encapsulating
   this detail.
 - The library path is only searched once during the execution of the
   binary, reducing the amount of file I/O done if multiple data files
   are accessed.
 - The library path is printed in the startup header, making it explicit
   where they are read (helpful in particular if there are problems with
   it, or the user may have multiple installations).  The GMXLIB
   override doesn't currently affect this printout; maybe it should, but
   I don't want to put the environment variable (and the support for
   multiple directories) into the program context.

Change-Id: I4d099215ef7e1f269d4c7a42989835d980bc1566
12 files changed:
src/gromacs/commandline/cmdlineprogramcontext.cpp
src/gromacs/commandline/cmdlineprogramcontext.h
src/gromacs/fileio/futil.cpp
src/gromacs/fileio/futil.h
src/gromacs/gmxlib/copyrite.cpp
src/gromacs/gmxlib/string2.c
src/gromacs/gmxpreprocess/fflibutil.cpp
src/gromacs/legacyheaders/string2.h
src/gromacs/utility/path.cpp
src/gromacs/utility/path.h
src/gromacs/utility/programcontext.cpp
src/gromacs/utility/programcontext.h