Blob Blame History Raw
--- sidplayfp-1.0.1.orig/src/args.cpp	2012-12-16 20:31:47.000000000 +0100
+++ sidplayfp-1.0.1/src/args.cpp	2013-04-13 12:08:07.937027479 +0200
@@ -25,6 +25,10 @@
 using std::endl;
 #include "player.h"
 
+#ifdef HAVE_UNISTD_H
+#   include <unistd.h>
+#endif
+
 #ifdef HAVE_SIDPLAYFP_BUILDERS_HARDSID_H
 #   include <sidplayfp/builders/hardsid.h>
 #endif
@@ -418,10 +422,20 @@
         }
         if (!m_timer.valid)
         {
+#if !defined _WIN32 && defined HAVE_UNISTD_H
+            char buffer[PATH_MAX];
+#endif
             const char *database = (m_iniCfg.sidplay2()).database;
             m_timer.length = (m_iniCfg.sidplay2()).playLength;
             if (m_driver.file)
                 m_timer.length = (m_iniCfg.sidplay2()).recordLength;
+#if !defined _WIN32 && defined HAVE_UNISTD_H
+            if (!database || *database == '\0') {
+                snprintf(buffer, PATH_MAX, "%sSonglengths.txt", PKGDATADIR);
+                if (::access(buffer, R_OK) == 0)
+                   database = buffer;
+            }
+#endif
             if (database && (*database != '\0'))
             {   // Try loading the database specificed by the user
                 if (!m_database.open (database))
--- sidplayfp-1.0.1/doc/en/sidplayfp.ini.5~	2013-04-13 12:16:39.000000000 +0200
+++ sidplayfp-1.0.1/doc/en/sidplayfp.ini.5	2013-04-13 12:22:09.317030709 +0200
@@ -33,6 +33,11 @@ Configuration version
 .TP
 \fBSonglength Database\fR=\fI<path>\fR
 Full path for the Songlength DB. Should point to the DOCUMENTS/Songlengths.txt file under the HVSC collection path.
+.P
+.RS
+On *NIX systems if this value is not set, sidplayfp will try
+$PREFIX/share/sidplayfp/Songlengths.txt .
+.RE
 .br
 
 .TP