@@ -254,7 +254,43 @@ void baseProject::addAddon(std::string addonName){
254
254
auto standardPath = ofFilePath::join (ofFilePath::join (getOFRoot (), " addons" ), addonName);
255
255
addon.fromFS (standardPath, target);
256
256
}
257
+
257
258
addAddon (addon);
259
+
260
+ // Process values from ADDON_DATA
261
+ if (addon.data .size ()){
262
+
263
+ for (auto & d : addon.data ){
264
+
265
+ filesystem::path path (ofFilePath::join (addon.addonPath , d));
266
+
267
+ if (filesystem::exists (path)){
268
+ if (filesystem::is_regular_file (path)){
269
+ ofFile src (path);
270
+ string dest = ofFilePath::join (projectDir, " bin/data/" );
271
+ ofStringReplace (d, " data/" , " " ); // avoid to copy files at /data/data/*
272
+ bool success = src.copyTo (ofFilePath::join (dest, d), false , true );
273
+ if (success){
274
+ ofLogVerbose () << " adding addon data file: " << d;
275
+ }else {
276
+ ofLogWarning () << " Can not add addon data file: " << d;
277
+ }
278
+ }else if (filesystem::is_directory (path)){
279
+ ofDirectory dir (path);
280
+ string dest = ofFilePath::join (projectDir, " bin/data/" );
281
+ ofStringReplace (d, " data/" , " " ); // avoid to copy files at /data/data/*
282
+ bool success = dir.copyTo (ofFilePath::join (dest, d), false , true );
283
+ if (success){
284
+ ofLogVerbose () << " adding addon data folder: " << d;
285
+ }else {
286
+ ofLogWarning () << " Can not add addon data folder: " << d;
287
+ }
288
+ }
289
+ }else {
290
+ ofLogWarning () << " addon data file does not exist, skipping: " << d;
291
+ }
292
+ }
293
+ }
258
294
}
259
295
260
296
void baseProject::addAddon (ofAddon & addon){
0 commit comments