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 encoded in utf8.
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 * and encoded in utf8.
27 * Each element is then passed through os::internal_path() to
28 * guarantee that it is in the form of a unix-style path.
29 * If the environment variable is not set, then the function returns
32 std::vector<std::string> const getEnvPath(std::string const & name);
34 /** Set the contents of the environment variable @c name to @c value.
35 * \p value is encoded in utf8.
36 * @returns true if the variable was set successfully.
38 bool setEnv(std::string const & name, std::string const & value);
40 /** Set the contents of the environment variable @c name
41 * using the paths stored in the @c env vector (encoded in utf8).
42 * Each element is passed through os::external_path().
43 * Multiple elements are concatenated into a single string using
44 * os::path_separator().
46 void setEnvPath(std::string const & name, std::vector<std::string> const & env);
48 /** Prepend a list of paths to that returned by the environment variable.
49 * Identical paths occurring later in the list are removed.
50 * @param name the name of the environment variable (encoded in utf8).
51 * @prefix the list of paths in OS-native syntax (encoded in utf8).
52 * Eg "/foo/bar:/usr/bin:/usr/local/bin" on *nix,
53 * "C:\foo\bar;C:\windows" on Windows.
55 void prependEnvPath(std::string const & name, std::string const & prefix);
57 } // namespace support
60 #endif // LYX_ENVIRONMENT_H