Skip to content

Commit 0eb9cf0

Browse files
2bbbarturoc
authored andcommitted
replace from ofSplitString to custom split string function (#184)
for example: ADDON_CPPFLAGS = "-Werror=return-type" would get split in the value =, getting the wrong result like -Werror.
1 parent d709ab2 commit 0eb9cf0

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

ofxProjectGenerator/src/addons/ofAddon.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,19 @@
1414
#include <list>
1515
using namespace std;
1616

17+
vector<string> splitStringOnceByLeft(const string &source, const string &delimiter) {
18+
size_t pos = source.find(delimiter);
19+
vector<string> res;
20+
if(pos == string::npos) {
21+
res.push_back(source);
22+
return res;
23+
}
24+
25+
res.push_back(source.substr(0, pos));
26+
res.push_back(source.substr(pos + delimiter.length()));
27+
return res;
28+
}
29+
1730
ofAddon::ofAddon(){
1831
isLocalAddon = false;
1932
pathToProject = ".";
@@ -391,10 +404,10 @@ void ofAddon::parseConfig(){
391404
vector<string> varValue;
392405
if(line.find("+=")!=string::npos){
393406
addToValue = true;
394-
varValue = ofSplitString(line,"+=");
407+
varValue = splitStringOnceByLeft(line,"+=");
395408
}else{
396409
addToValue = false;
397-
varValue = ofSplitString(line,"=");
410+
varValue = splitStringOnceByLeft(line,"=");
398411
}
399412
variable = Poco::trim(varValue[0]);
400413
value = Poco::trim(varValue[1]);

0 commit comments

Comments
 (0)