4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Angus Leeming
9 * Full author contact details are available in file CREDITS.
12 #ifndef LYX_ENVIRONMENT_H
13 #define LYX_ENVIRONMENT_H
21 /// @returns the contents of the environment variable @c name.
22 std::string const getEnv(std::string const & envname);
24 /** @returns the contents of the environment variable @c name,
25 * split into path elements using the OS-dependent separator token.
26 * Each element is then passed through os::internal_path() to
27 * guarantee that it is in the form of a unix-style path.
28 * If the environment variable is not set, then the function returns
31 std::vector<std::string> const getEnvPath(std::string const & name);
33 /** Set the contents of the environment variable @c name to @c value.
34 * @returns true if the variable was set successfully.
36 bool setEnv(std::string const & name, std::string const & value);
38 /** Set the contents of the environment variable @c name
39 * using the paths stored in the @c env vector.
40 * Each element is passed through os::external_path().
41 * Multiple elements are concatenated into a single string using
42 * os::path_separator().
44 void setEnvPath(std::string const & name, std::vector<std::string> const & env);
46 /** Prepend a list of paths to that returned by the environment variable.
47 * Identical paths occurring later in the list are removed.
48 * @param name the name of the environment variable.
49 * @prefix the list of paths in OS-native syntax.
50 * Eg "/foo/bar:/usr/bin:/usr/local/bin" on *nix,
51 * "C:\foo\bar;C:\windows" on Windows.
53 void prependEnvPath(std::string const & name, std::string const & prefix);
55 } // namespace support
58 #endif // LYX_ENVIRONMENT_H