@@ -94,7 +94,7 @@ void ofAddon::addReplaceStringVector(std::vector<string> & variable, string valu
9494 string varName = varMatch[2 ].str ();
9595 string varValue;
9696 if (varName == " OF_ROOT" ){
97- varValue = pathToOF. string ( );
97+ varValue = ofPathToString (pathToOF );
9898 }else if (getenv (varName.c_str ())){
9999 varValue = getenv (varName.c_str ());
100100 }
@@ -103,11 +103,11 @@ void ofAddon::addReplaceStringVector(std::vector<string> & variable, string valu
103103 }
104104 }
105105
106- if (prefix==" " || values[i].find (pathToOF. string ( ))==0 || fs::path{values[i]}.is_absolute ()) {
107- variable.push_back (values[i]);
106+ if (prefix==" " || values[i].find (ofPathToString (pathToOF ))==0 || fs::path{values[i]}.is_absolute ()) {
107+ variable.emplace_back (values[i]);
108108 } else {
109109 fs::path p = fs::path{ prefix } / values[i];
110- variable.push_back (p. string ( ));
110+ variable.emplace_back ( ofPathToString (p ));
111111 }
112112 }
113113 }
@@ -133,7 +133,7 @@ void ofAddon::addReplaceStringVector(vector<LibraryBinary> & variable, string va
133133 string varName = varMatch[2 ].str ();
134134 string varValue;
135135 if (varName == " OF_ROOT" ){
136- varValue = pathToOF. string ( );
136+ varValue = ofPathToString (pathToOF );
137137 }else if (getenv (varName.c_str ())){
138138 varValue = getenv (varName.c_str ());
139139 }
@@ -143,11 +143,11 @@ void ofAddon::addReplaceStringVector(vector<LibraryBinary> & variable, string va
143143 }
144144
145145
146- if (prefix == " " || v.find (pathToOF. string ( )) == 0 || fs::path{v}.is_absolute ()) {
146+ if (prefix == " " || v.find (ofPathToString (pathToOF )) == 0 || fs::path{v}.is_absolute ()) {
147147 variable.push_back ( { v, " " , " " } );
148148 } else {
149149 fs::path p = fs::path { prefix } / v;
150- variable.push_back ( { p. string ( ), " " , " " } );
150+ variable.push_back ( { ofPathToString (p ), " " , " " } );
151151 }
152152 }
153153 }
@@ -202,7 +202,7 @@ void ofAddon::parseVariableValue(const string & variable, const string & value,
202202// alert ("value " + value, 36);
203203// }
204204// cout << includePaths.size() << endl;
205- addReplaceStringVector (includePaths, value, addonRelPath. string ( ), addToValue);
205+ addReplaceStringVector (includePaths, value, ofPathToString (addonRelPath ), addToValue);
206206// cout << includePaths.size() << endl;
207207// cout << "----" << endl;
208208 }
@@ -220,7 +220,7 @@ void ofAddon::parseVariableValue(const string & variable, const string & value,
220220 }
221221
222222 else if (variable == ADDON_LIBS){
223- addReplaceStringVector (libs, value, addonRelPath. string ( ), addToValue);
223+ addReplaceStringVector (libs, value, ofPathToString (addonRelPath ), addToValue);
224224 }
225225
226226 else if (variable == ADDON_DLLS_TO_COPY){
@@ -240,23 +240,23 @@ void ofAddon::parseVariableValue(const string & variable, const string & value,
240240 }
241241
242242 else if (variable == ADDON_SOURCES){
243- addReplaceStringVector (srcFiles, value, addonRelPath. string ( ) ,addToValue);
243+ addReplaceStringVector (srcFiles, value, ofPathToString (addonRelPath ) ,addToValue);
244244 }
245245
246246 else if (variable == ADDON_C_SOURCES){
247- addReplaceStringVector (csrcFiles, value, addonRelPath. string ( ) ,addToValue);
247+ addReplaceStringVector (csrcFiles, value, ofPathToString (addonRelPath ) ,addToValue);
248248 }
249249
250250 else if (variable == ADDON_CPP_SOURCES){
251- addReplaceStringVector (cppsrcFiles, value, addonRelPath. string ( ) ,addToValue);
251+ addReplaceStringVector (cppsrcFiles, value, ofPathToString (addonRelPath ) ,addToValue);
252252 }
253253
254254 else if (variable == ADDON_HEADER_SOURCES){
255- addReplaceStringVector (headersrcFiles, value, addonRelPath. string ( ) ,addToValue);
255+ addReplaceStringVector (headersrcFiles, value, ofPathToString (addonRelPath ) ,addToValue);
256256 }
257257
258258 else if (variable == ADDON_OBJC_SOURCES){
259- addReplaceStringVector (objcsrcFiles, value, addonRelPath. string ( ) ,addToValue);
259+ addReplaceStringVector (objcsrcFiles, value, ofPathToString (addonRelPath ) ,addToValue);
260260 }
261261
262262 else if (variable == ADDON_DATA){
@@ -472,7 +472,7 @@ void ofAddon::parseLibsPath(const fs::path & libsPath, const fs::path & parentFo
472472 getLibsRecursively (libsPath, libFiles, libs, platform);
473473 if (platform == " osx" || platform == " ios" ){
474474 getFrameworksRecursively (libsPath, frameworks, platform);
475- getXCFrameworksRecursively (libsPath, frameworks , platform);
475+ getXCFrameworksRecursively (libsPath, xcframeworks , platform);
476476 }
477477
478478 if (platform == " vs" || platform == " msys2"
@@ -493,7 +493,7 @@ void ofAddon::parseLibsPath(const fs::path & libsPath, const fs::path & parentFo
493493 if (!isLocalAddon) {
494494 for (auto & l : libs) {
495495// alert("fixpath before " + l.path);
496- l.path = fixPath (l.path ). string ( );
496+ l.path = ofPathToString ( fixPath (l.path ));
497497// alert("fixpath after " + l.path);
498498 }
499499 }
@@ -506,8 +506,9 @@ void ofAddon::parseLibsPath(const fs::path & libsPath, const fs::path & parentFo
506506 folder = fs::relative (s.parent_path (), getOFRoot ());
507507 s = fixPath (s);
508508 }
509- srcFiles.emplace_back (s.string ());
510- filesToFolders[s.string ()] = folder.string ();
509+ string f { ofPathToString (s) };
510+ srcFiles.emplace_back (f);
511+ filesToFolders[f] = ofPathToString (folder);
511512 }
512513
513514 // so addons will never be system.
@@ -533,7 +534,7 @@ void ofAddon::parseLibsPath(const fs::path & libsPath, const fs::path & parentFo
533534 folder = fs::path { " local_addons" } / fs::relative (fFS .parent_path (), parentFolder);
534535 }
535536
536- filesToFolders[f] = folder. string ( );
537+ filesToFolders[f] = ofPathToString (folder );
537538 }
538539 }
539540
@@ -547,7 +548,7 @@ void ofAddon::parseLibsPath(const fs::path & libsPath, const fs::path & parentFo
547548 folder = fs::path { " local_addons" } / fs::relative (fFS .parent_path (), parentFolder);
548549 }
549550
550- filesToFolders[f] = folder. string ( );
551+ filesToFolders[f] = ofPathToString (folder );
551552 }
552553}
553554
@@ -562,11 +563,8 @@ bool ofAddon::fromFS(const fs::path & path, const string & platform){
562563 this ->platform = platform;
563564
564565 addonPath = path;
565- if (isLocalAddon) {
566- name = path.stem ().string ();
567- } else {
568- name = path.filename ().string ();
569- }
566+
567+ name = isLocalAddon ? ofPathToString (path.stem ()) : ofPathToString (path.filename ());
570568
571569 fs::path srcPath { path / " src" };
572570 if (fs::exists (srcPath)) {
@@ -579,16 +577,16 @@ bool ofAddon::fromFS(const fs::path & path, const string & platform){
579577 fs::path parentFolder { path.parent_path () };
580578
581579 for (auto & s : srcFiles) {
582- fs::path sFS { s };
583580 fs::path folder;
584581 if (isLocalAddon) {
582+ fs::path sFS { s };
585583 folder = fs::path { " local_addons" } / fs::relative (sFS .parent_path (), parentFolder);
586584 } else {
587- sFS = fixPath (s);
588- s = sFS . string ( );
585+ fs::path sFS { fixPath (s) } ;
586+ s = ofPathToString ( sFS );
589587 folder = fs::relative (sFS .parent_path (), getOFRoot ());
590588 }
591- filesToFolders[s] = folder. string ( );
589+ filesToFolders[s] = ofPathToString (folder );
592590 }
593591
594592
@@ -635,7 +633,7 @@ bool ofAddon::fromFS(const fs::path & path, const string & platform){
635633 paths.sort ();
636634
637635 for (auto & p : paths) {
638- includePaths.emplace_back (p. string () );
636+ includePaths.emplace_back ( ofPathToString (p) );
639637 }
640638
641639 parseConfig ();
0 commit comments