small tool to dump default config.
authorRobin Gareus <robin@gareus.org>
Sun, 22 Mar 2015 21:15:37 +0000 (22:15 +0100)
committerRobin Gareus <robin@gareus.org>
Sun, 22 Mar 2015 21:15:37 +0000 (22:15 +0100)
cfgtool/cfgtool.cc [new file with mode: 0644]
cfgtool/wscript [new file with mode: 0644]
wscript

diff --git a/cfgtool/cfgtool.cc b/cfgtool/cfgtool.cc
new file mode 100644 (file)
index 0000000..5f39bd5
--- /dev/null
@@ -0,0 +1,39 @@
+#include <stdio.h>
+
+#include "pbd/pbd.h"
+#include "pbd/xml++.h"
+#include "ardour/rc_configuration.h"
+#include "pbd/enumwriter.h"
+
+using namespace ARDOUR;
+using namespace std;
+
+int main (int argc, char **argv) {
+       if (argc < 2) {
+               fprintf(stderr, "usage %s <file-name>\n", argv[0]);
+               return -1;
+       }
+
+       setenv ("ARDOUR_DLL_PATH", "/xxx", 1);
+       setenv ("ARDOUR_CONFIG_PATH", "/xxx", 1);
+
+       if (!ARDOUR::init (false, true, "/xxx")) {
+               fprintf(stderr, "Failed to initialize libardour\n");
+               return -1;
+       }
+
+       RCConfiguration * rc = new RCConfiguration;
+       XMLNode& state = rc->get_state();
+
+       // TODO strip some nodes here ?
+
+       XMLTree tree;
+       tree.set_root (&state);
+
+       if (!tree.write (argv[1])) {
+               fprintf(stderr, "Error saving config file '%s'\n", argv[1]);
+               return -1;
+       }
+
+       return 0;
+}
diff --git a/cfgtool/wscript b/cfgtool/wscript
new file mode 100644 (file)
index 0000000..be349da
--- /dev/null
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+from waflib.extras import autowaf as autowaf
+from waflib import Options, TaskGen
+import waflib.Logs as Logs, waflib.Utils as Utils
+import shutil
+import sys
+import time
+
+top = '.'
+out = 'build'
+
+def options(opt):
+    autowaf.set_options(opt)
+
+def configure(conf):
+    conf.load('misc')
+    conf.load('compiler_cxx')
+    autowaf.configure(conf)
+
+def build(bld):
+    obj = bld (features = 'cxx c cxxprogram')
+    obj.source    = 'cfgtool.cc'
+    obj.target    = 'cfgtool'
+    obj.use       = [ 'libpbd', 'libardour', ]
diff --git a/wscript b/wscript
index 63a7537bc6cd804a4a6d177837da9627de80664a..9ffeebd75ec4c0bb9128943faeb87d679c44e582 100644 (file)
--- a/wscript
+++ b/wscript
@@ -197,6 +197,7 @@ children = [
         'libs/fst',
         'libs/vfork',
         'libs/ardouralsautil',
+        'cfgtool',
 ]
 
 i18n_children = [