Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy data specified in ADDON_DATA when parsing addon_config.mk #92

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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 @@ -273,7 +273,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
16 changes: 16 additions & 0 deletions ofxProjectGenerator/src/projects/baseProject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,23 @@ 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()) {
string dest = ofFilePath::join(projectDir, "bin/data/");

for (auto& filename : addon.data) {
ofFile src(ofFilePath::join(addon.addonPath, filename));
if (!src.exists()) {
ofLogWarning() << "addon data file does not exist, skipping: " << filename;
} else {
ofLogVerbose() << "adding addon data files: " << filename;
src.copyTo(ofFilePath::join(dest, src.getFileName()), false, true);
}
}
}
}

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 @@ -67,7 +67,7 @@ class baseProject {
virtual void addAfterRule(std::string script){}

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