1212// #include "Poco/RegularExpression.h"
1313#include < list>
1414#include < regex>
15- using namespace std ;
15+
16+ using std::vector;
17+ using std::string;
18+ namespace fs = of::filesystem;
1619
1720vector<string> splitStringOnceByLeft (const string &source, const string &delimiter) {
1821 size_t pos = source.find (delimiter);
@@ -179,7 +182,7 @@ void ofAddon::addReplaceStringVector(std::vector<std::string> & variable, std::s
179182 varValue = getenv (varName.c_str ());
180183 }
181184 ofStringReplace (values[i]," $(" +varName+" )" ,varValue);
182- ofLogVerbose (" ofAddon" ) << " addon config: substituting " << varName << " with " << varValue << " = " << values[i] << endl;
185+ ofLogVerbose (" ofAddon" ) << " addon config: substituting " << varName << " with " << varValue << " = " << values[i] << std:: endl;
183186 }
184187 }
185188
@@ -216,7 +219,7 @@ void ofAddon::addReplaceStringVector(vector<LibraryBinary> & variable, string va
216219 varValue = getenv (varName.c_str ());
217220 }
218221 ofStringReplace (values[i]," $(" +varName+" )" ,varValue);
219- ofLogVerbose (" ofAddon" ) << " addon config: substituting " << varName << " with " << varValue << " = " << values[i] << endl;
222+ ofLogVerbose (" ofAddon" ) << " addon config: substituting " << varName << " with " << varValue << " = " << values[i] << std:: endl;
220223 }
221224 }
222225
@@ -240,7 +243,7 @@ void ofAddon::parseVariableValue(string variable, string value, bool addToValue,
240243 }
241244
242245
243- of::filesystem ::path addonRelPath;
246+ fs ::path addonRelPath;
244247 if (!isLocalAddon) {
245248 // addonRelPath = ofFilePath::addTrailingSlash(pathToOF) + "addons/" + name;
246249 addonRelPath = pathToOF / " addons" / name;
@@ -474,12 +477,12 @@ void ofAddon::parseConfig(){
474477 }
475478}
476479
477- bool ofAddon::fromFS (of::filesystem ::path path, const std::string & platform){
480+ bool ofAddon::fromFS (fs ::path path, const std::string & platform){
478481 clear ();
479482 this ->platform = platform;
480483
481- of::filesystem ::path prefixPath;
482- of::filesystem ::path containedPath;
484+ fs ::path prefixPath;
485+ fs ::path containedPath;
483486
484487 if (isLocalAddon){
485488 name = path.stem ().string ();
@@ -506,15 +509,15 @@ bool ofAddon::fromFS(of::filesystem::path path, const std::string & platform){
506509
507510 // FIXME: srcFiles to fs::path
508511 for (auto & s : srcFiles) {
509- of::filesystem ::path folder;
512+ fs ::path folder;
510513 if (isLocalAddon) {
511514 // FIXME: test if local addons is working ok
512- folder = of::filesystem:: path (" local_addons" ) / of::filesystem ::path (s).parent_path ();
515+ folder = fs:: path (" local_addons" ) / fs ::path (s).parent_path ();
513516 } else {
514- folder = of::filesystem ::path (s).parent_path ();
515- folder = of::filesystem ::relative (folder, containedPath);
517+ folder = fs ::path (s).parent_path ();
518+ folder = fs ::relative (folder, containedPath);
516519 }
517- s = of::filesystem:: path (prefixPath / of::filesystem ::relative (s, containedPath)).string ();
520+ s = fs:: path (prefixPath / fs ::relative (s, containedPath)).string ();
518521 filesToFolders[s] = folder.string ();
519522 }
520523
@@ -525,20 +528,20 @@ bool ofAddon::fromFS(of::filesystem::path path, const std::string & platform){
525528
526529 // FIXME: propsFiles to fs::path
527530 for (auto & s : propsFiles) {
528- of::filesystem ::path folder;
531+ fs ::path folder;
529532 if (isLocalAddon) {
530533 // FIXME: test if local addons is working ok
531- folder = of::filesystem:: path (" local_addons" ) / of::filesystem ::path (s).parent_path ();
534+ folder = fs:: path (" local_addons" ) / fs ::path (s).parent_path ();
532535 } else {
533- folder = of::filesystem ::path (s).parent_path ();
534- folder = of::filesystem ::relative (folder, containedPath);
536+ folder = fs ::path (s).parent_path ();
537+ folder = fs ::relative (folder, containedPath);
535538 }
536- s = of::filesystem:: path (prefixPath / of::filesystem ::relative (s, containedPath)).string ();
539+ s = fs:: path (prefixPath / fs ::relative (s, containedPath)).string ();
537540 }
538541
539542// for (int i = 0; i < (int)propsFiles.size(); i++) {
540543// propsFiles[i].erase(propsFiles[i].begin(), propsFiles[i].begin() + containedPath.string().length());
541- // int end = propsFiles[i].rfind(of::filesystem ::path("/").make_preferred().string());
544+ // int end = propsFiles[i].rfind(fs ::path("/").make_preferred().string());
542545// int init = 0;
543546// string folder;
544547// if (!isLocalAddon) {
@@ -552,7 +555,7 @@ bool ofAddon::fromFS(of::filesystem::path path, const std::string & platform){
552555// }
553556
554557
555- of::filesystem ::path libsPath = path / " libs" ;
558+ fs ::path libsPath = path / " libs" ;
556559 vector < string > libFiles;
557560
558561 if (ofDirectory (libsPath).exists ()){
@@ -569,31 +572,31 @@ bool ofAddon::fromFS(of::filesystem::path path, const std::string & platform){
569572
570573
571574 for (auto & s : libFiles) {
572- of::filesystem ::path folder;
575+ fs ::path folder;
573576 if (isLocalAddon) {
574577 // FIXME: test if local addons is working ok
575- folder = of::filesystem:: path (" local_addons" ) / of::filesystem ::path (s).parent_path ();
578+ folder = fs:: path (" local_addons" ) / fs ::path (s).parent_path ();
576579 } else {
577- folder = of::filesystem ::path (s).parent_path ();
578- folder = of::filesystem ::relative (folder, containedPath);
580+ folder = fs ::path (s).parent_path ();
581+ folder = fs ::relative (folder, containedPath);
579582 }
580- s = of::filesystem:: path (prefixPath / of::filesystem ::relative (s, containedPath)).string ();
583+ s = fs:: path (prefixPath / fs ::relative (s, containedPath)).string ();
581584 srcFiles.emplace_back (s);
582585 filesToFolders[s] = folder.string ();
583586 }
584587
585588
586589 // changing libs folder from absolute to relative.
587590 for (auto & l : libs) {
588- l.path = of::filesystem:: path (prefixPath / of::filesystem ::relative (l.path , containedPath)).string ();
591+ l.path = fs:: path (prefixPath / fs ::relative (l.path , containedPath)).string ();
589592 }
590593
591594
592595// for (int i = 0; i < (int)libs.size(); i++){
593596//
594597// cout << "libs path before " << libs[i].path << endl;
595598// // does libs[] have any path ? let's fix if so.
596- // int end = libs[i].path.rfind(of::filesystem ::path("/").make_preferred().string());
599+ // int end = libs[i].path.rfind(fs ::path("/").make_preferred().string());
597600// if (end > 0){
598601// libs[i].path.erase (libs[i].path.begin(), libs[i].path.begin() + containedPath.string().length());
599602// libs[i].path = prefixPath.string() + libs[i].path;
@@ -624,7 +627,7 @@ bool ofAddon::fromFS(of::filesystem::path path, const std::string & platform){
624627 frameworks[i].erase (frameworks[i].begin (), frameworks[i].begin () + containedPath.string ().length ());
625628
626629 int init = 0 ;
627- int end = frameworks[i].rfind (of::filesystem ::path (" /" ).make_preferred ().string ());
630+ int end = frameworks[i].rfind (fs ::path (" /" ).make_preferred ().string ());
628631
629632 string folder;
630633 if (!isLocalAddon) {
@@ -644,7 +647,7 @@ bool ofAddon::fromFS(of::filesystem::path path, const std::string & platform){
644647 }
645648
646649 // paths that are needed for the includes.
647- list < of::filesystem ::path > paths;
650+ std:: list < fs ::path > paths;
648651
649652 // get every folder in addon/src and addon/libs
650653 vector < string > libFolders;
@@ -659,11 +662,11 @@ bool ofAddon::fromFS(of::filesystem::path path, const std::string & platform){
659662
660663 // convert paths to relative
661664 for (auto & l : libFolders) {
662- paths.push_back ({ prefixPath / of::filesystem:: relative (of::filesystem ::path (l), containedPath) });
665+ paths.push_back ({ prefixPath / fs:: relative (fs ::path (l), containedPath) });
663666 }
664667
665668 for (auto & l : srcFolders) {
666- paths.push_back ({ prefixPath / of::filesystem:: relative (of::filesystem ::path (l), containedPath) });
669+ paths.push_back ({ prefixPath / fs:: relative (fs ::path (l), containedPath) });
667670 }
668671
669672 paths.sort (); // paths.unique(); // unique not needed anymore. everything is carefully inserted now.
0 commit comments