X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fsupport%2FPackage.cpp;h=bdba77e7ac72780cafd97a6ad3e3b341683b6789;hb=28be7d552f62cc02fa86d7f79201d089bfb2d7b5;hp=59972d23c4c96a52b323a382cea11f5d1620b103;hpb=3f59d7e2cc6a3f9a09631c804b49b6d28e05d857;p=lyx.git diff --git a/src/support/Package.cpp b/src/support/Package.cpp index 59972d23c4..bdba77e7ac 100644 --- a/src/support/Package.cpp +++ b/src/support/Package.cpp @@ -21,18 +21,22 @@ #include "support/lassert.h" #include "support/lstrings.h" #include "support/os.h" +#include "support/PathChanger.h" +#include "support/Systemcall.h" #if defined (USE_WINDOWS_PACKAGING) # include "support/os_win32.h" #endif +#include #include #if !defined (USE_WINDOWS_PACKAGING) && \ !defined (USE_MACOSX_PACKAGING) && \ + !defined (USE_HAIKU_PACKAGING) && \ !defined (USE_POSIX_PACKAGING) -#error USE_FOO_PACKAGING must be defined for FOO = WINDOWS, MACOSX or POSIX. +#error USE_FOO_PACKAGING must be defined for FOO = WINDOWS, MACOSX, HAIKU or POSIX. #endif #if defined (USE_MACOSX_PACKAGING) @@ -138,11 +142,6 @@ Package::Package(string const & command_line_arg0, explicit_user_support_dir_ = userSupportDir(default_user_support_dir, command_line_user_support_dir, user_support_dir_); - FileName const configure_script(addName(system_support().absFileName(), "configure.py")); - configure_command_ = os::python() + ' ' + - quoteName(configure_script.toFilesystemEncoding(), quote_python) + - with_version_suffix() + " --binary-dir=" + - quoteName(FileName(binary_dir().absFileName()).toFilesystemEncoding()); LYXERR(Debug::INIT, "\n" << "\tbinary_dir " << binary_dir().absFileName() << '\n' @@ -157,6 +156,31 @@ Package::Package(string const & command_line_arg0, } +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()) @@ -168,10 +192,12 @@ void Package::set_temp_dir(FileName const & temp_dir) const FileName Package::messages_file(string const & c) const { - if (in_build_dir_) - return FileName(top_srcdir().absFileName() + "/po/" - + c + ".gmo"); - else + 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"); } @@ -276,7 +302,7 @@ bool isBuildDir(FileName const & abs_binary, string const & dir_location, return true; } // cmake file, no Makefile in lib - FileName build_boost_dir = FileName(addPath(search_dir, "boost")); + FileName build_boost_dir = FileName(addPath(search_dir + "/3rdparty", "boost")); if (!fileSearch(build_boost_dir.absFileName(), "cmake_install.cmake").empty()) { return true; } @@ -625,9 +651,6 @@ get_system_support_dir(FileName const & abs_binary, "to the LyX system directory containing the " "file `chkconfig.ltx'."), from_utf8(searched_dirs_str), from_ascii(LYX_DIR_VER))); - - // Keep the compiler happy. - return FileName(); } @@ -665,12 +688,15 @@ FileName const get_default_user_support_dir(FileName const & home_dir) #elif defined (USE_MACOSX_PACKAGING) && (QT_VERSION >= 0x050000) (void)home_dir; // Silence warning about unused variable. - return FileName(addPath(fromqstr(QStandardPaths::writableLocation(QStandardPaths::DataLocation)), PACKAGE)); + return FileName(addPath(fromqstr(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)), PACKAGE)); #elif defined (USE_MACOSX_PACKAGING) (void)home_dir; // Silence warning about unused variable. return FileName(addPath(fromqstr(QDesktopServices::storageLocation(QDesktopServices::DataLocation)), PACKAGE)); +#elif defined (USE_HAIKU_PACKAGING) + return FileName(addPath(home_dir.absFileName(), string("/config/settings/") + PACKAGE)); + #else // USE_POSIX_PACKAGING return FileName(addPath(home_dir.absFileName(), string(".") + PACKAGE)); #endif