]> git.lyx.org Git - lyx.git/blob - src/support/environment.h
Remove spurious unicode char in comment.
[lyx.git] / src / support / environment.h
1 // -*- C++ -*-
2 /**
3  * \file environment.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Angus Leeming
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef LYX_ENVIRONMENT_H
13 #define LYX_ENVIRONMENT_H
14
15 #include <string>
16 #include <vector>
17
18 namespace lyx {
19 namespace support {
20
21 /// @returns the contents of the environment variable @c name.
22 std::string const getEnv(std::string const & envname);
23
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
29  *  an empty vector.
30  */
31 std::vector<std::string> const getEnvPath(std::string const & name);
32
33 /** Set the contents of the environment variable @c name to @c value.
34  *  @returns true if the variable was set successfully.
35  */
36 bool setEnv(std::string const & name, std::string const & value);
37
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().
43  */
44 void setEnvPath(std::string const & name, std::vector<std::string> const & env);
45
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.
52  */
53 void prependEnvPath(std::string const & name, std::string const & prefix);
54
55 } // namespace support
56 } // namespace lyx
57
58 #endif // LYX_ENVIRONMENT_H