]> git.lyx.org Git - lyx.git/blobdiff - src/support/Package.cpp
Fix bug #4269
[lyx.git] / src / support / Package.cpp
index 66b0e60f0ad80455490926792f0665fd606d813d..8b6fa0b03ae8becd97c3bc5c7b6caaa3245ecca7 100644 (file)
@@ -34,8 +34,9 @@
 
 #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)
@@ -54,7 +55,7 @@ namespace {
 Package package_;
 bool initialised_ = false;
 
-} // namespace anon
+} // namespace
 
 
 void init_package(string const & command_line_arg0,
@@ -100,7 +101,7 @@ string const & with_version_suffix();
 
 string const fix_dir_name(string const & name);
 
-} // namespace anon
+} // namespace
 
 
 Package::Package(string const & command_line_arg0,
@@ -176,7 +177,7 @@ int Package::reconfigureUserLyXDir(string const & option) const
 
 string Package::getConfigureLockName() const
 {
-       return user_support().absFileName() + ".lyx_configure_lock";
+       return addName(user_support().absFileName(), ".lyx_configure_lock");
 }
 
 
@@ -192,7 +193,9 @@ void Package::set_temp_dir(FileName const & temp_dir) const
 FileName Package::messages_file(string const & c) const
 {
        if (in_build_dir_) {
-               FileName res = FileName(lyx_dir().absFileName() + "/../po/" + c + ".gmo");
+               FileName res = FileName(lyx_dir().absFileName() + "/po/" + c + ".gmo");
+               if (!res.isReadableFile())
+                       res = FileName(lyx_dir().absFileName() + "../po/" + c + ".gmo");
                if (!res.isReadableFile())
                        res = FileName(top_srcdir().absFileName() + "/po/" + c + ".gmo");
                return res;
@@ -246,7 +249,7 @@ string const & with_version_suffix()
        return program_suffix.empty() ? program_suffix : with_version_suffix;
 }
 
-} // namespace anon
+} // namespace
 
 
 FileName const & Package::top_srcdir()
@@ -301,8 +304,8 @@ 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"));
-    if (!fileSearch(build_boost_dir.absFileName(), "cmake_install.cmake").empty()) {
+    FileName build_src_dir = FileName(addPath(search_dir, "src"));
+    if (!fileSearch(build_src_dir.absFileName(), "cmake_install.cmake").empty()) {
         return true;
     }
 
@@ -373,7 +376,7 @@ bool doesFileExist(FileName & result, string const & search_dir, string const &
 bool lyxBinaryPath(FileName & lyx_binary, string const & search_dir, string const & ext)
 {
     lyx_binary = FileName();
-    if(false) {   
+    if(false) {
     } else if (doesFileExist(lyx_binary, search_dir, "lyx" + ext)) {
     } else if (doesFileExist(lyx_binary, search_dir, "LyX" + ext)) {
     } else if (doesFileExist(lyx_binary, search_dir, "lyx" + string(PROGRAM_SUFFIX) + ext)) {
@@ -396,9 +399,9 @@ FileName findLyxBinary(FileName const & abs_binary)
     else if (!abs_binary.extension().empty()) {
         ext = "." + abs_binary.extension();
     }
-    
+
     string binary_dir = onlyPath(abs_binary.absFileName());
-      
+
     FileName lyx_binary;
     if (lyxBinaryPath(lyx_binary, binary_dir, ext))
         return lyx_binary;
@@ -406,7 +409,7 @@ FileName findLyxBinary(FileName const & abs_binary)
     string search_dir = onlyPath(FileName(addPath(binary_dir, "/../")).absFileName());
     if (lyxBinaryPath(lyx_binary, search_dir, ext))
         return lyx_binary;
-    
+
     return FileName();
 }
 
@@ -650,9 +653,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();
 }
 
 
@@ -690,12 +690,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
@@ -798,7 +801,7 @@ string const relative_system_support_dir()
        return result;
 }
 
-} // namespace anon
+} // namespace
 
 } // namespace support
 } // namespace lyx