[beast: 7/14] SFI: add installpath_override() Signed-off-by: Tim Janik <timj gnu org>



commit c1c8d9975c6481f46078773de0b83a05ba973a48
Author: Tim Janik <timj gnu org>
Date:   Mon Dec 7 20:08:54 2015 +0100

    SFI: add installpath_override()
    Signed-off-by: Tim Janik <timj gnu org>

 sfi/glib-extra.cc |   16 +++++++++++++---
 sfi/glib-extra.hh |    7 ++++++-
 2 files changed, 19 insertions(+), 4 deletions(-)
---
diff --git a/sfi/glib-extra.cc b/sfi/glib-extra.cc
index 811e518..49c35cd 100644
--- a/sfi/glib-extra.cc
+++ b/sfi/glib-extra.cc
@@ -1027,13 +1027,23 @@ g_scanner_new64 (const GScannerConfig *config_templ)
 }
 
 
+#include "../configure.h"
+
 namespace Bse {
 
 // == BSE_INSTALLPATH ==
-#include "../configure.h"
+static String installpath_topdir;
+
+void
+installpath_override (const String &topdir)
+{
+  installpath_topdir = topdir;
+}
+
 std::string
 installpath (InstallpathType installpath_type)
 {
+  const bool ovr = !installpath_topdir.empty();
   switch (installpath_type)
     {
     case INSTALLPATH_BSEINCLUDEDIR:                     return CONFIGURE_INSTALLPATH_BSEINCLUDEDIR;
@@ -1042,7 +1052,7 @@ installpath (InstallpathType installpath_type)
     case INSTALLPATH_LADSPA:                            return CONFIGURE_INSTALLPATH_LADSPA;
     case INSTALLPATH_DOCDIR:                            return CONFIGURE_INSTALLPATH_DOCDIR;
     case INSTALLPATH_USER_DATA:                         return CONFIGURE_INSTALLPATH_USER_DATA;
-    case INSTALLPATH_BSELIBDIR:                         return CONFIGURE_INSTALLPATH_BSELIBDIR;
+    case INSTALLPATH_BSELIBDIR:                         return ovr ? installpath_topdir : 
CONFIGURE_INSTALLPATH_BSELIBDIR;
     case INSTALLPATH_BSELIBDIR_PLUGINS:                 return installpath (INSTALLPATH_BSELIBDIR) + 
"/plugins";
     case INSTALLPATH_BSELIBDIR_DRIVERS:                 return installpath (INSTALLPATH_BSELIBDIR) + 
"/drivers";
     case INSTALLPATH_DATADIR:                           return CONFIGURE_INSTALLPATH_DATADIR;
@@ -1054,7 +1064,7 @@ installpath (InstallpathType installpath_type)
     case INSTALLPATH_DATADIR_IMAGES:                    return installpath (INSTALLPATH_DATADIR) + "/images";
     case INSTALLPATH_DATADIR_KEYS:                      return installpath (INSTALLPATH_DATADIR) + "/keys";
     case INSTALLPATH_DATADIR_SKINS:                     return installpath (INSTALLPATH_DATADIR) + "/skins";
-    case INSTALLPATH_BEASTEXECDIR:                      return CONFIGURE_INSTALLPATH_BEASTEXECDIR;
+    case INSTALLPATH_BEASTEXECDIR:                      return ovr ? installpath_topdir : 
CONFIGURE_INSTALLPATH_BEASTEXECDIR;
     case INSTALLPATH_PYBEASTDIR:                        return installpath (INSTALLPATH_BEASTEXECDIR) + 
"/pybeast";
     }
   return "";
diff --git a/sfi/glib-extra.hh b/sfi/glib-extra.hh
index 362bf34..c32b777 100644
--- a/sfi/glib-extra.hh
+++ b/sfi/glib-extra.hh
@@ -334,6 +334,10 @@ constexpr GConnectFlags  operator~  (GConnectFlags  s1)                 { return
 // these definitions need to move into bse/utils or similar
 namespace Bse {
 
+// import helpers from Rapicorn
+using Rapicorn::String;
+namespace Path = Rapicorn::Path;
+
 // == INSTALLPATH ==
 // See also configure.ac, this function is here because beast and all libs include this file.
 enum InstallpathType {
@@ -359,7 +363,8 @@ enum InstallpathType {
   INSTALLPATH_PYBEASTDIR,
 };
 /// Provide installation directories and searchpaths for various types of data.
-std::string installpath  (InstallpathType installpath_type);
+String installpath          (InstallpathType installpath_type);
+void   installpath_override (const String &topdir);
 
 /// Provide a string containing the BSE library version number.
 std::string version ();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]