do not install cfgtool
[ardour.git] / cfgtool / cfgtool.cc
1 #include <stdio.h>
2
3 #include "pbd/pbd.h"
4 #include "pbd/xml++.h"
5 #include "ardour/rc_configuration.h"
6 #include "pbd/enumwriter.h"
7
8 using namespace ARDOUR;
9 using namespace std;
10
11 int main (int argc, char **argv) {
12         if (argc < 2) {
13                 fprintf(stderr, "usage %s <file-name>\n", argv[0]);
14                 return -1;
15         }
16
17         setenv ("ARDOUR_DLL_PATH", "/xxx", 1);
18         setenv ("ARDOUR_CONFIG_PATH", "/xxx", 1);
19
20         if (!ARDOUR::init (false, true, "/xxx")) {
21                 fprintf(stderr, "Failed to initialize libardour\n");
22                 return -1;
23         }
24
25         RCConfiguration * rc = new RCConfiguration;
26         XMLNode& state = rc->get_state();
27
28         // TODO strip some nodes here ?
29
30         XMLTree tree;
31         tree.set_root (&state);
32
33         if (!tree.write (argv[1])) {
34                 fprintf(stderr, "Error saving config file '%s'\n", argv[1]);
35                 return -1;
36         }
37
38         return 0;
39 }