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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
diff -aur triceratops-lv2-v0.2.0/presets.cpp triceratops-lv2-v0.2.0.patched/presets.cpp
--- triceratops-lv2-v0.2.0/presets.cpp 2014-06-18 13:33:34.000000000 +0200
+++ triceratops-lv2-v0.2.0.patched/presets.cpp 2014-09-11 10:43:59.932732363 +0200
@@ -470,7 +470,7 @@
void presets::get_preset_names()
{
- //------------------- LOAD /usr/lib/lv2/triceratops-presets.lv2/ presets
+ //------------------- LOAD ~/.lv2/triceratops-presets.lv2/ presets
stringstream home_lv2;
home_lv2.str("");
@@ -484,74 +484,74 @@
{
cout << "No presets found in " << dir << endl;
closedir(dp);
- return;
+ // return;
}
-
- while ((dirp = readdir(dp)) != NULL)
- {
- if (string(dirp->d_name) != ".directory" &&
- string(dirp->d_name) != "." &&
- string(dirp->d_name) != ".." &&
- string(dirp->d_name) != "manifest.ttl")
+ else {
+ while ((dirp = readdir(dp)) != NULL)
{
- stringstream file_name;
- file_name.str("");
- file_name << "." << dirp->d_name;
-
- stringstream preset_file_name_home;
- preset_file_name_home.str("");
- preset_file_name_home << getenv("HOME") << "/.lv2/";
- preset_file_name_home << file_name.str().substr(1);
- preset_file_name_home << "/";
- dir = preset_file_name_home.str();
- int file_name_length = file_name.str().length();
- preset_file_name_home << file_name.str().substr(1,file_name_length-4);
- preset_file_name_home << "ttl";
-
- bool our_preset = false;
-
- ifstream check_file(preset_file_name_home.str());
- string line;
- int preset_category_number = 0;
-
- while (getline(check_file,line))
+ if (string(dirp->d_name) != ".directory" &&
+ string(dirp->d_name) != "." &&
+ string(dirp->d_name) != ".." &&
+ string(dirp->d_name) != "manifest.ttl")
{
- int triceratops_applies_to =
- line.rfind("lv2:appliesTo <http://nickbailey.co.nr/triceratops>");
+ stringstream file_name;
+ file_name.str("");
+ file_name << "." << dirp->d_name;
+
+ stringstream preset_file_name_home;
+ preset_file_name_home.str("");
+ preset_file_name_home << getenv("HOME") << "/.lv2/";
+ preset_file_name_home << file_name.str().substr(1);
+ preset_file_name_home << "/";
+ dir = preset_file_name_home.str();
+ int file_name_length = file_name.str().length();
+ preset_file_name_home << file_name.str().substr(1,file_name_length-4);
+ preset_file_name_home << "ttl";
- if (triceratops_applies_to > 0) our_preset = true;
+ bool our_preset = false;
- int preset_category_finder = line.rfind("preset_category");
- if (preset_category_finder > 0)
+ ifstream check_file(preset_file_name_home.str());
+ string line;
+ int preset_category_number = 0;
+
+ while (getline(check_file,line))
{
- getline(check_file,line);
- istringstream (line.substr(line.rfind("pset:value") + 11)) >> preset_category_number;
+ int triceratops_applies_to =
+ line.rfind("lv2:appliesTo <http://nickbailey.co.nr/triceratops>");
+
+ if (triceratops_applies_to > 0) our_preset = true;
+
+ int preset_category_finder = line.rfind("preset_category");
+ if (preset_category_finder > 0)
+ {
+ getline(check_file,line);
+ istringstream (line.substr(line.rfind("pset:value") + 11)) >> preset_category_number;
+ }
}
- }
- if (our_preset)
- {
- preset_file_names.push_back(file_name.str());
- presets_object new_preset_object;
+ if (our_preset)
+ {
+ preset_file_names.push_back(file_name.str());
+ presets_object new_preset_object;
- new_preset_object.type = PRESET_TYPE_PRESET;
- new_preset_object.category = preset_category_number;
-
- stringstream file_name_ttl;
- file_name_ttl.str("");
- file_name_ttl << file_name.str().substr(1,file_name.str().size()-4) << "ttl";
+ new_preset_object.type = PRESET_TYPE_PRESET;
+ new_preset_object.category = preset_category_number;
- new_preset_object.name = file_name_ttl.str();
- new_preset_object.dir = dir;
- new_preset_object.unfold = false;
+ stringstream file_name_ttl;
+ file_name_ttl.str("");
+ file_name_ttl << file_name.str().substr(1,file_name.str().size()-4) << "ttl";
- preset_list.push_back(new_preset_object);
+ new_preset_object.name = file_name_ttl.str();
+ new_preset_object.dir = dir;
+ new_preset_object.unfold = false;
+
+ preset_list.push_back(new_preset_object);
+ }
}
- }
+ }
+ closedir(dp);
}
- closedir(dp);
-
//------------------- LOAD /usr/lib/lv2/triceratops-presets.lv2/ presets
@@ -563,7 +563,6 @@
else
{
-
while ((dirp = readdir(dp)) != NULL)
{
if (string(dirp->d_name) != ".directory" &&
@@ -1305,9 +1304,14 @@
string triceratops_ttl_file_name = "";
ifstream triceratops_ttl("/usr/lib/lv2/triceratops.lv2/triceratops.ttl" );
- if (triceratops_ttl) triceratops_ttl_file_name = "/usr/lib/lv2/triceratops.lv2/triceratops.ttl" ;
- triceratops_ttl.open("/usr/local/lib/lv2/triceratops.lv2/triceratops.ttl" );
- if (triceratops_ttl) triceratops_ttl_file_name = "/usr/local/lib/lv2/triceratops.lv2/triceratops.ttl";
+ if (triceratops_ttl)
+ {
+ triceratops_ttl_file_name = "/usr/lib/lv2/triceratops.lv2/triceratops.ttl";
+ } else
+ {
+ triceratops_ttl.open("/usr/local/lib/lv2/triceratops.lv2/triceratops.ttl" );
+ if (triceratops_ttl) triceratops_ttl_file_name = "/usr/local/lib/lv2/triceratops.lv2/triceratops.ttl";
+ }
int current_port = -1;
int symbol_port = -1;
|