summaryrefslogtreecommitdiff
path: root/cfgtool/cfgtool.cc
blob: 021484671bfaf70d6352eb13b6cadeae1a968bd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <stdio.h>
#include <glib.h>

#include "pbd/xml++.h"
#include "ardour/rc_configuration.h"

using namespace ARDOUR;
using namespace std;

int main (int argc, char **argv) {
	if (argc < 2) {
		fprintf(stderr, "Usage: %s [-h] <file-name>\n", argv[0]);
		return -1;
	}

	if (!strcmp (argv[1], "-h") || !strcmp (argv[1], "--help")) {
		fprintf(stdout, "Usage: %s <file-name>\n\n", argv[0]);
		fprintf(stdout, "Writes the default Ardour config to the given file\n");
		return 0;
	}

	g_setenv ("ARDOUR_DLL_PATH", "/xxx", 1);
	g_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();

	XMLNode* cfg = state.child ("Config");
	cfg->remove_nodes_and_delete ("name", "donate-url");
	cfg->remove_nodes_and_delete ("name", "osx_pingback-url");
	cfg->remove_nodes_and_delete ("name", "linux-pingback-url");
	cfg->remove_nodes_and_delete ("name", "updates-url");
	cfg->remove_nodes_and_delete ("name", "freesound-download-dir"); // user specific

	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;
}


#include "ardour/vst_types.h"
int vstfx_init (void*) { return 0; }
void vstfx_exit () {}
void vstfx_destroy_editor (VSTState*) {}