Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ofxProjectGenerator/src/addons/ofAddon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ void ofAddon::parseVariableValue(string variable, string value, bool addToValue,
}

if(variable == "ADDON_DATA"){
addReplaceStringVector(data,value,addonRelPath,addToValue);
addReplaceStringVector(data,value,"",addToValue);
}

if(variable == "ADDON_LIBS_EXCLUDE"){
Expand Down
36 changes: 36 additions & 0 deletions ofxProjectGenerator/src/projects/baseProject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,43 @@ void baseProject::addAddon(std::string addonName){
auto standardPath = ofFilePath::join(ofFilePath::join(getOFRoot(), "addons"), addonName);
addon.fromFS(standardPath, target);
}

addAddon(addon);

// Process values from ADDON_DATA
if(addon.data.size()){

for(auto& d : addon.data){

filesystem::path path(ofFilePath::join(addon.addonPath, d));

if(filesystem::exists(path)){
if (filesystem::is_regular_file(path)){
ofFile src(path);
string dest = ofFilePath::join(projectDir, "bin/data/");
ofStringReplace(d, "data/", ""); // avoid to copy files at /data/data/*
bool success = src.copyTo(ofFilePath::join(dest, d), false, true);
if(success){
ofLogVerbose() << "adding addon data file: " << d;
}else {
ofLogWarning() << "Can not add addon data file: " << d;
}
}else if(filesystem::is_directory(path)){
ofDirectory dir(path);
string dest = ofFilePath::join(projectDir, "bin/data/");
ofStringReplace(d, "data/", ""); // avoid to copy files at /data/data/*
bool success = dir.copyTo(ofFilePath::join(dest, d), false, true);
if(success){
ofLogVerbose() << "adding addon data folder: " << d;
}else{
ofLogWarning() << "Can not add addon data folder: " << d;
}
}
}else{
ofLogWarning() << "addon data file does not exist, skipping: " << d;
}
}
}
}

void baseProject::addAddon(ofAddon & addon){
Expand Down
2 changes: 1 addition & 1 deletion ofxProjectGenerator/src/projects/baseProject.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class baseProject {
virtual void addDefine(std::string define, LibType libType = RELEASE_LIB) {}

virtual void addAddon(std::string addon);
virtual void addAddon(ofAddon & addon);
virtual void addAddon(ofAddon & addon);

std::string getName() { return projectName;}
std::string getPath() { return projectDir; }
Expand Down