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.
11 * A store of the paths to the various different directoies used
12 * by LyX. These paths differ markedly from one OS to another,
13 * following the local Windows, MacOS X or Posix conventions.
25 /** When run in-place <build-dir>/src/lyx is one level up from
26 * the <build-dir> whilst <build-dir>/src/tex2lyx/tex2lyx is
29 enum exe_build_dir_to_top_build_dir {
30 top_build_dir_is_one_level_up,
31 top_build_dir_is_two_levels_up
35 /** Initialise package() with the command line data.
36 * This data is exactly as it was passed in the argv[] array.
38 * @param command_line_arg0 argv[0], the name of the LyX executable
39 * as passed on the command line.
41 * @param command_line_system_support_dir, the LyX system dir,
42 * as specified on the command line with "-sysdir <path to dir>".
44 * @param command_line_user_support_dir, the LyX user dir,
45 * as specified on the command line with "-userdir <path to dir>".
47 void init_package(std::string const & command_line_arg0,
48 std::string const & command_line_system_support_dir,
49 std::string const & command_line_user_support_dir,
50 exe_build_dir_to_top_build_dir);
52 /** Accessor to the global data.
53 * Asserts that init_package() has been called first.
55 Package const & package();
59 /// Default constructor does not lead to the paths being set.
62 /** Called by init_package, above.
63 * All paths will be initialized.
65 Package(std::string const & command_line_arg0,
66 std::string const & command_line_system_support_dir,
67 std::string const & command_line_user_support_dir,
68 exe_build_dir_to_top_build_dir);
70 /** The directory containing the LyX executable.
72 std::string const & binary_dir() const;
74 /** The top of the LyX source code tree.
76 std::string const & top_srcdir() const;
78 /** The path to the system-level support files
79 * we're actually going to use.
81 std::string const & system_support() const;
83 /** The path to the autogenerated support files
84 * when running in-place.
86 std::string const & build_support() const;
88 /** The path to the user-level support files.
90 std::string const & user_support() const;
92 /** The user_support directory was set explicitly using either
93 * the -userdir command line switch or
94 * the LYX_USERDIR_15x environment variable.
96 bool explicit_user_support() const;
98 /** The path to the locale directory.
100 std::string const & locale_dir() const;
102 /** The default document directory.
103 * Can be reset by LyXRC.
105 std::string & document_dir() const;
107 /** The path to the system temporary directory.
110 std::string const & system_temp_dir() const;
112 /** The path to the temporary directory used by LyX.
113 * (Eg /tmp/lyx_tmpdir800nBI1z9 on *nix.)
114 * Can be reset by LyXRC.
116 std::string & temp_dir() const;
118 /** Used when setting the user_support directory.
119 * Used also when expanding "~/" or contracting to "~/". (filetools.C)
120 * Used in emergencyWrite (bufferlist.C) as one possible location
122 * This may be empty (e. g. when run under a CGI environment)
124 std::string const & home_dir() const;
126 /// Command to run the configure script
127 std::string const & configure_command() const;
130 std::string binary_dir_;
131 std::string system_support_dir_;
132 std::string build_support_dir_;
133 std::string user_support_dir_;
134 std::string locale_dir_;
135 mutable std::string document_dir_;
136 mutable std::string temp_dir_;
137 std::string system_temp_dir_;
138 std::string home_dir_;
139 std::string configure_command_;
140 bool explicit_user_support_dir_;
145 Package::Package() {}
148 std::string const & Package::binary_dir() const
154 std::string const & Package::system_support() const
156 return system_support_dir_;
160 std::string const & Package::build_support() const
162 return build_support_dir_;
166 std::string const & Package::user_support() const
168 return user_support_dir_;
172 bool Package::explicit_user_support() const
174 return explicit_user_support_dir_;
178 std::string const & Package::locale_dir() const
184 std::string & Package::document_dir() const
186 return document_dir_;
190 std::string & Package::temp_dir() const
196 std::string const & Package::system_temp_dir() const
198 return system_temp_dir_;
202 std::string const & Package::home_dir() const
208 std::string const & Package::configure_command() const
210 return configure_command_;
213 } // namespace support
216 #endif // LYX_PACHAGE_H