[beast: 7/47] V8BSE: load plugins at startup with load_assets() and installpath_override()



commit 71a5a68b0cb8aac49e2425633954c2896a388caa
Author: Tim Janik <timj gnu org>
Date:   Fri May 26 00:38:25 2017 +0200

    V8BSE: load plugins at startup with load_assets() and installpath_override()
    
    Signed-off-by: Tim Janik <timj gnu org>

 ebeast/v8bse/nodemodule.cc |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/ebeast/v8bse/nodemodule.cc b/ebeast/v8bse/nodemodule.cc
index acc3aad..d84c026 100644
--- a/ebeast/v8bse/nodemodule.cc
+++ b/ebeast/v8bse/nodemodule.cc
@@ -214,6 +214,13 @@ v8bse_register_module (v8::Local<v8::Object> exports)
 
   v8::HandleScope scope (isolate);
 
+  // prepare Bse environment
+  const char *canary = "library/demo/partymonster.bse";
+  const std::string installpath = Bse::Path::realpath (Bse::Path::abspath ("..")); // ebeast/..
+  if (!Bse::Path::check (Bse::Path::join (installpath, canary), "r"))
+    Bse::fatal ("%s: BSE: failed to locate library containing '%s'", installpath, canary);
+  Bse::installpath_override (installpath);
+
   // start Bse
   Bse::String bseoptions = Bse::string_format ("debug-extensions=%d", 0);
   Bse::init_async (NULL, NULL, "BEAST", Bse::string_split (bseoptions, ":"));
@@ -278,6 +285,9 @@ v8bse_register_module (v8::Local<v8::Object> exports)
   // debugging aids:
   if (0)
     Bse::printerr ("gdb %s %u -ex 'catch catch' -ex 'catch throw'\n", program_invocation_name, 
Bse::ThisThread::process_pid());
+
+  // Ensure Bse has everything properly loaded
+  bse_server.load_assets();
 }
 
 // node.js registration


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