+int Package::reconfigureUserLyXDir(string const & option) const
+{
+ if (configure_command_.empty()) {
+ FileName const configure_script(addName(system_support().absFileName(), "configure.py"));
+ configure_command_ = os::python() + ' ' +
+ quoteName(configure_script.toFilesystemEncoding()) +
+ with_version_suffix() + " --binary-dir=" +
+ quoteName(FileName(binary_dir().absFileName()).toFilesystemEncoding());
+ }
+
+ lyxerr << to_utf8(_("LyX: reconfiguring user directory")) << endl;
+ PathChanger p(user_support());
+ Systemcall one;
+ int const ret = one.startscript(Systemcall::Wait, configure_command_ + option);
+ lyxerr << "LyX: " << to_utf8(_("Done!")) << endl;
+ return ret;
+}
+
+
+string Package::getConfigureLockName() const
+{
+ return addName(user_support().absFileName(), ".lyx_configure_lock");
+}
+
+
+void Package::set_temp_dir(FileName const & temp_dir) const
+{
+ if (temp_dir.empty())
+ temp_dir_ = system_temp_dir_;
+ else
+ temp_dir_ = temp_dir;
+}
+
+
+FileName Package::messages_file(string const & c) const
+{
+ if (in_build_dir_) {
+ FileName res = FileName(lyx_dir().absFileName() + "/../po/" + c + ".gmo");
+ if (!res.isReadableFile())
+ res = FileName(top_srcdir().absFileName() + "/po/" + c + ".gmo");
+ return res;
+ } else
+ return FileName(locale_dir_.absFileName() + "/" + c
+ + "/LC_MESSAGES/" PACKAGE ".mo");
+}
+
+
+// The specification of home_dir_ is fixed for a given OS.
+// A typical example on Windows: "C:/Documents and Settings/USERNAME"
+// and on a Posix-like machine: "/home/USERNAME".
+FileName const & Package::get_home_dir()
+{
+#if defined (USE_WINDOWS_PACKAGING)
+ static FileName const home_dir(getEnv("USERPROFILE"));
+#elif defined (USE_MACOSX_PACKAGING)
+ static FileName const home_dir(fromqstr(QDir::homePath()));
+#else // Posix-like.
+ static FileName const home_dir(getEnv("HOME"));
+#endif
+ return home_dir;
+}
+
+