]> git.lyx.org Git - lyx.git/blobdiff - src/support/Package.cpp
Remove non-copyable idioms
[lyx.git] / src / support / Package.cpp
index f5ee5d5436fb5ee4a9457c67b27689f35e3bf21b..1fd47eca6880cdea39b09b6f7926f3ac88e7c415 100644 (file)
 #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 <iostream>
 #include <list>
 
 #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)
@@ -151,17 +155,29 @@ Package::Package(string const & command_line_arg0,
                << "</package>\n");
 }
 
-std::string const & Package::configure_command() const
+
+int Package::reconfigureUserLyXDir(string const & option) const
 {
        if (configure_command_.empty()) {
-               std::string &command = const_cast<std::string&>(configure_command_);
                FileName const configure_script(addName(system_support().absFileName(), "configure.py"));
-               command = os::python() + ' ' +
+               configure_command_ = os::python() + ' ' +
                        quoteName(configure_script.toFilesystemEncoding()) +
                        with_version_suffix() + " --binary-dir=" +
                        quoteName(FileName(binary_dir().absFileName()).toFilesystemEncoding());
        }
-       return configure_command_;
+
+       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");
 }
 
 
@@ -286,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;
     }
@@ -675,12 +691,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