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 /** Initialise package() with the command line data.
26 * This data is exactly as it was passed in the argv[] array.
28 * @param command_line_arg0 argv[0], the name of the LyX executable
29 * as passed on the command line.
31 * @param command_line_system_support_dir, the LyX system dir,
32 * as specified on the command line with "-sysdir <path to dir>".
34 * @param command_line_user_support_dir, the LyX user dir,
35 * as specified on the command line with "-userdir <path to dir>".
37 void init_package(std::string const & command_line_arg0,
38 std::string const & command_line_system_support_dir,
39 std::string const & command_line_user_support_dir);
41 /** Accessor to the global data.
42 * Asserts that init_package() has been called first.
44 Package const & package();
48 /// Default constructor does not lead to the paths being set.
51 /** Called by init_package, above.
52 * All paths will be initialized.
54 Package(std::string const & command_line_arg0,
55 std::string const & command_line_system_support_dir,
56 std::string const & command_line_user_support_dir);
58 /** The directory containing the LyX executable.
60 std::string const & binary_dir() const;
62 /** The top of the LyX source code tree.
63 * Used by the GTK frontend when searching for .glade files.
65 std::string const & top_srcdir() const;
67 /** The path to the system-level support files
68 * we're actually going to use.
70 std::string const & system_support() const;
72 /** The path to the autogenerated support files
73 * when running in-place.
75 std::string const & build_support() const;
77 /** The path to the user-level support files.
79 std::string const & user_support() const;
81 /** The user_support directory was set explicitly using either
82 * the -userdir command line switch or
83 * the LYX_USERDIR_13x environment variable.
85 bool explicit_user_support() const;
87 /** The path to the locale directory.
89 std::string const & locale_dir() const;
91 /** The default document directory.
92 * Can be reset by LyXRC.
94 std::string & document_dir() const;
96 /** The path to the temporary directory.
98 * Can be reset by LyXRC.
100 std::string & temp_dir() const;
102 /** Used when setting the user_support directory.
103 * Used also when expanding "~/" or contracting to "~/". (filetools.C)
104 * Used by the XForms file dialog.
105 * Used in emergencyWrite (bufferlist.C) as one possible location
108 std::string const & home_dir() const;
111 std::string binary_dir_;
112 std::string system_support_dir_;
113 std::string build_support_dir_;
114 std::string user_support_dir_;
115 std::string locale_dir_;
116 mutable std::string document_dir_;
117 mutable std::string temp_dir_;
118 std::string home_dir_;
119 bool explicit_user_support_dir_;
124 Package::Package() {}
127 std::string const & Package::binary_dir() const
133 std::string const & Package::system_support() const
135 return system_support_dir_;
139 std::string const & Package::build_support() const
141 return build_support_dir_;
145 std::string const & Package::user_support() const
147 return user_support_dir_;
151 bool Package::explicit_user_support() const
153 return explicit_user_support_dir_;
157 std::string const & Package::locale_dir() const
163 std::string & Package::document_dir() const
165 return document_dir_;
169 std::string & Package::temp_dir() const
175 std::string const & Package::home_dir() const
180 } // namespace support
183 #endif // LYX_PACHAGE_H