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

of::filesystem PR #7110

Merged
merged 102 commits into from
Mar 7, 2023
Merged
Show file tree
Hide file tree
Changes from 79 commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
2e03222
not working yet
dimitre Aug 3, 2022
2c9f061
some more
dimitre Aug 10, 2022
910f7d2
ok finally
dimitre Aug 10, 2022
554beb1
update
dimitre Aug 11, 2022
992b2d5
of::filesystem
dimitre Aug 11, 2022
b101f89
fix non macos files
dimitre Aug 12, 2022
5b4d74e
now working with make
dimitre Aug 14, 2022
b7756d9
fileutils
dimitre Aug 14, 2022
2f338b6
tests
dimitre Aug 14, 2022
405273b
fix other platforms
dimitre Aug 14, 2022
9dcd50e
assimp fix
dimitre Aug 14, 2022
2011155
join fix
dimitre Aug 14, 2022
63a3de1
more updates
dimitre Aug 14, 2022
d85de52
more updates
dimitre Aug 14, 2022
768da30
more updates 3
dimitre Aug 14, 2022
87e7ee4
more updates 5
dimitre Aug 14, 2022
2c2397d
more 6
dimitre Aug 14, 2022
f99500e
update 7
dimitre Aug 14, 2022
9e580bf
fix 8
dimitre Aug 14, 2022
0cbe497
up 9
dimitre Aug 14, 2022
3011a65
workflows and ofxSvg
dimitre Aug 14, 2022
171310c
up 10
dimitre Aug 15, 2022
0a0c8d7
actions
dimitre Aug 15, 2022
a7c70ff
ccache
dimitre Aug 15, 2022
16c25a2
ccache
dimitre Aug 15, 2022
685a2d9
act
dimitre Aug 15, 2022
ccc8feb
act
dimitre Aug 15, 2022
6edfd28
act
dimitre Aug 15, 2022
d1c0a84
act
dimitre Aug 15, 2022
3135f5b
act
dimitre Aug 15, 2022
7b6ee70
act
dimitre Aug 15, 2022
d2d2f04
actions
dimitre Aug 15, 2022
98fcfa5
actions
dimitre Aug 15, 2022
5457d30
actions
dimitre Aug 15, 2022
2b8fa6f
actions
dimitre Aug 15, 2022
4f5ee39
make -j -s
dimitre Aug 15, 2022
469685f
up
dimitre Aug 15, 2022
a52a6a9
Merge branch 'openframeworks:master' into lite
dimitre Aug 23, 2022
118955c
reverting some updates to master
dimitre Sep 28, 2022
38aba25
reverting
dimitre Sep 28, 2022
49f20f7
updates
dimitre Sep 28, 2022
f7a66d1
updates
dimitre Sep 28, 2022
d608ceb
revert files
dimitre Sep 28, 2022
8940614
more
dimitre Sep 28, 2022
abe1458
updates
dimitre Sep 28, 2022
b12b190
ofdirectoshowplayer
dimitre Sep 28, 2022
af277ff
font
dimitre Sep 28, 2022
5eefe56
Merge branch 'master' into filesystem
dimitre Sep 28, 2022
b0d4765
fix android
dimitre Sep 28, 2022
c5b749c
filesystem spaghetti
dimitre Sep 29, 2022
f4716a5
update
dimitre Sep 29, 2022
7db22f0
constants
dimitre Sep 29, 2022
696e8fe
ofSetDataPathRoot
dimitre Sep 29, 2022
c62e854
update test
dimitre Sep 29, 2022
aa06269
updates
dimitre Sep 29, 2022
9d37db4
getAbsolutePath
dimitre Sep 29, 2022
10740c4
unittest
dimitre Sep 29, 2022
ac9478e
assimp
dimitre Sep 29, 2022
c9b5f18
fix tests for mingw
dimitre Sep 29, 2022
fa47f8a
Merge branch 'master' into filesystem
dimitre Oct 1, 2022
3af37ad
update constants
dimitre Oct 1, 2022
6f85521
reverting more files
dimitre Oct 1, 2022
cafcc3e
updates
dimitre Oct 1, 2022
7368359
assimp fix?
dimitre Oct 2, 2022
34a7a6b
constants
dimitre Oct 2, 2022
a0d6288
namespace fix
dimitre Oct 2, 2022
bca09a0
actions
dimitre Oct 2, 2022
5e7134a
filePath
dimitre Oct 2, 2022
162663d
updates
dimitre Oct 2, 2022
269f768
rm removed files
dimitre Oct 5, 2022
9d96dac
updates
dimitre Jan 31, 2023
67216b3
Merge branch 'openframeworks:master' into filesystem
dimitre Jan 31, 2023
469f5a6
fixing conflicts
dimitre Feb 12, 2023
b386f80
assimp
dimitre Feb 12, 2023
d647ccf
update filesystem::path
dimitre Feb 12, 2023
2b04fe7
fix assimp textures load, still needs some cleanup
dimitre Feb 12, 2023
464f9fb
update
dimitre Feb 12, 2023
2d3706e
Merge branch 'openframeworks:master' into filesystem
dimitre Feb 15, 2023
0dd7001
fix conflicts
dimitre Feb 17, 2023
a5f4285
updates
dimitre Feb 17, 2023
74ac3c0
remove constants
dimitre Feb 17, 2023
a279999
comment cleanup
dimitre Feb 17, 2023
5d1adf4
remove .string()
dimitre Feb 17, 2023
4cf8462
Merge branch 'master' into filesystem
dimitre Feb 25, 2023
201e5fb
Merge branch 'filesystem' into updatefs
dimitre Feb 25, 2023
65ed292
Merge pull request #16 from openframeworks/updatefs
dimitre Feb 25, 2023
381013b
cubemap fix
dimitre Feb 25, 2023
ee78c03
fix assimp
dimitre Feb 25, 2023
2f0d9d4
cleanup comment
dimitre Feb 25, 2023
252a8a6
uniformity in spaces
dimitre Feb 25, 2023
5113cf0
uniformity in spaces
dimitre Feb 25, 2023
5d47d83
cleanup comments
dimitre Feb 25, 2023
8cdf577
comments cleanup
dimitre Feb 25, 2023
c36e856
string alongside path
dimitre Mar 4, 2023
a89cd81
back to string on return types
dimitre Mar 4, 2023
80c1299
fixes
dimitre Mar 4, 2023
376211e
fix issues
dimitre Mar 6, 2023
d2d874e
more fixes
dimitre Mar 6, 2023
bb9558e
tests fix
dimitre Mar 6, 2023
70c2fa9
try catch
dimitre Mar 7, 2023
fa895ae
try catch in #else
dimitre Mar 7, 2023
76ef977
typo
dimitre Mar 7, 2023
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 addons/ofxAndroid/src/ofAppAndroidWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ Java_cc_openframeworks_OFAndroid_setAppDataDir( JNIEnv* env, jobject thiz, jst
jboolean iscopy;
const char *mfile = env->GetStringUTFChars(data_dir, &iscopy);
__android_log_print(ANDROID_LOG_INFO,"ofAppAndroidWindow",("setting app dir name to: \"" + string(mfile) + "\"").c_str());
ofSetDataPathRoot(string(mfile)+"/");
ofSetDataPathRoot({ string(mfile)+"/" });
env->ReleaseStringUTFChars(data_dir, mfile);
}

Expand Down
2 changes: 1 addition & 1 deletion addons/ofxAndroid/src/ofxAndroidSoundPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ ofxAndroidSoundPlayer::~ofxAndroidSoundPlayer(){


//------------------------------------------------------------
bool ofxAndroidSoundPlayer::load(const std::filesystem::path& fileName, bool stream){
bool ofxAndroidSoundPlayer::load(const of::filesystem::path& fileName, bool stream){
if(!javaSoundPlayer){
ofLogError("ofxAndroidSoundPlayer") << "loadSound(): java SoundPlayer not loaded";
return false;
Expand Down
2 changes: 1 addition & 1 deletion addons/ofxAndroid/src/ofxAndroidSoundPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class ofxAndroidSoundPlayer: public ofBaseSoundPlayer{
ofxAndroidSoundPlayer();
virtual ~ofxAndroidSoundPlayer();

bool load(const std::filesystem::path& fileName, bool stream = false);
bool load(const of::filesystem::path& fileName, bool stream = false);
void unload();
void play();
void stop();
Expand Down
34 changes: 25 additions & 9 deletions addons/ofxAssimpModelLoader/src/ofxAssimpModelLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ bool ofxAssimpModelLoader::load(string modelName, int assimpOptimizeFlags){
// }

// loads scene from file
std::string path = file.getAbsolutePath();
std::string path = file.getAbsolutePath().string();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious - does std::string path = file.getAbsolutePath(); not work with this change?
Or is this just being more proper? 🙂

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in this PR getAbsolutePath now returns of::filesystem::path instead of string, so it is needed to convert to string in this case

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm - I think that could break a ton of addons/projects/code etc if it doesn't auto convert.

One thing that might work is to have std::string and of::filesystem::path versions of both with deprecation?
Or maybe we could figure out a way to have path auto convert to string with = operator overload?

I think without it we'll break a ton of stuff 🙂

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you're right. I'm good about any of this. maybe keeping std::string for legacy compatibility, I can do that soon

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cannot have both functions with same name and different return type. I'm unsure of how to proceed here. I know it is not your style but I would suggest we switch to of::filesystem and live with labor pains.
What is your recommendation on this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Motivation behind this PR: uniformize of::filesystem outside of std, instead of try to tuck everything inside std::filesystem (there are different versions of c++11, experimental c++17 and boost filesystem)
And another motivation is try to rely more on filesystem::path instead of converting from string to path and vice versa depending on the functions.

3 . If approved other leftovers can be done in separate PRs easier to read. I can see other places like
ofCairoRenderer::setup(const std::string & _filename and setupShaderFromSource

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK very clear! i'm not in a position to test things but as you propagated the changes in a good number of components with success it's clearly a positive move forward. my only comment (and maybe that falls in a "style" discussion) it so committing commented unused/updated code -- i understand the value of that while working, being able to quickly refer to the past and toggle "versions", but in committed core code it adds a bit of noise (even more so within large #ifdef blocks like in ofConstants.h which are hard to follow). it also provides traction for the of:: namespace.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally agree @artificiel. I've just cleaned out the comments. Thanks for the reading.
@ofTheo I really think the potential cons are outweighted by pros of this change
And this can be useful for tackle some projectGenerator issues, which uses a mixture of filesystem and Poco::Path

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@artificiel some more context for the changes are in this issues:
#6585 (comment)

Will add to the main PR description to link the issues.

@dimitre - going to take a look at this today.
Most nervous about changing the return types for the ofFile:: call from string to path. I def agree path is better especially for international support, but thinking about all the things this could break ( similar of a break as going from ofPoint to glm::vec3 ).

Going to see if there is a solution so we can have cake and eat it 🙂
Curious if anyone has creative ideas there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i must confess i'm not sure about what requires the of:filesystem (vs direct std::filesystem) but i'm presuming that has been sorted out and is the right thing to do — it does not change the fact that returning one or the other is different than std::string.

  1. direct implicit conversions such as std::string p = my_dir.getAbsolutePath(); will fail on windows. but the current getAbsolutePath() method makes use of .string() to output strings:

    string ofDirectory::getAbsolutePath() const {
    try{
    return std::filesystem::canonical(std::filesystem::absolute(myDir)).string();
    }catch(...){
    return std::filesystem::absolute(myDir).string();
    }

    which means it forces the conversion of windows wstring to string, which is convenient but "incorrect"....

  2. what is going to break globally is things like the usage of strings to construct ad-hoc paths:

std::string my_m = d.getAbsolutePath() + "/my_mov.mov"; 

but that usage should be definitely be shifted (not advocating this a good path strategy just pointing the "most-direct-adaptation" here):

auto my_m =  d.getAbsolutePath() / "my_mov.mov";
my_movie.load(my_m);
ofLogNotice("my_m") << my_m;

so these breaking changes are breaking on things that should be fixed.

the glm transition example is interesting, and i remember the moment of that change OF_USE_LEGACY_VECTOR_MATH seemed like a good thing, but in truth it's like making a deal with the credit card company: feels like a win today, but in the end you pay more anyhow. (and someone paid for all those #ifdefs's!)

(and the case of filesystem::path is even more necessary as it's a conceptual transition upgrading a bare string to a structured object, not a transition between somewhat "equivalent" systems).

one thing though: this means that all the interfaces and all the examples must be adapted — to a learning mind, a stale example is worse than no example... it should not be hard, but it has to be done coherently.

i will allow myself to re-phrase my take on the relationship between to OF source and one's projects:

  • either the project is in development (in which case, either you are under deadline pressure and stick with a release in the "production mindset", or you are comfortable riding git and working on something that tolerates these moments to happen)
  • or the project is old, and either you stick to the old OF codebase (the copy you took with your project archive, or the freshly downloaded corresponding archive, hoping it still compiles), or try to work it up to today. considering there are 15-year old OF projects i find it "out of scope" to try to support legacy at all costs as the "responsibilities" of OF are small vs the evolution of OS API's, IDE's and C++ (especially since we are not talking about incremental upgrades -- if you pull out a 2010 project, you will not "upgrade" to each sequential OF, OS and compiler versions until you hit today, you will point your project to an OF tree and compile with your current setup. there are so many variables involved in that i don't think it's good to burden OF with additional work that makes older edge cases work transparently).

(i find the OF deprecation strategy very nice -- the old functions can hang in there for ever, and politely point out the better option to the user; unfortunately there is no way to do something like that with return types).

const aiScene * scenePtr = importer.ReadFile(path.c_str(), flags);

//this is funky but the scenePtr is managed by assimp and so we can't put it in our shared_ptr without disabling the deleter with: [](const aiScene*){}
Expand Down Expand Up @@ -373,6 +373,7 @@ void ofxAssimpModelLoader::loadGLResources(){

std::string texPathStr = texPath.C_Str();

// std::cout << "first texPathStr: " << texPathStr << std::endl;
//deal with Blender putting "//" in front of local file paths
if( texPathStr.size() > 2 && texPathStr.substr(0, 2) == "//" ){
texPathStr = texPathStr.substr(2, texPathStr.size()-2);
Expand All @@ -388,20 +389,35 @@ void ofxAssimpModelLoader::loadGLResources(){
auto ogPath = texPathStr;
bool bHasEmbeddedTexture = false;

string modelFolder = ofFilePath::getEnclosingDirectory( file.path() );
string relTexPath = ofFilePath::getEnclosingDirectory(texPathStr,false);
string texFile = ofFilePath::getFileName(texPathStr);
string realPath = ofFilePath::join(ofFilePath::join(modelFolder, relTexPath), texFile);
// FIXME: Convert everything possible to fs. remove .string() in the end
auto modelFolder = ofFilePath::getEnclosingDirectory( file.path() );
auto relTexPath = ofFilePath::getEnclosingDirectory(texPathStr,false);
auto realPath = modelFolder / of::filesystem::path{ texPathStr };

using std::cout;
using std::endl;
cout << "modelFolder : " << modelFolder << endl;
cout << "texPathStr : " << texPathStr << endl;
cout << "relTexPath : " << relTexPath.string() << endl;
cout << "realPath : " << realPath.string() << endl;
dimitre marked this conversation as resolved.
Show resolved Hide resolved


// modelFolder : "../MacOS/../../../data/FlightHelmet/"
// texPathStr : FlightHelmet_Materials_LeatherPartsMat_Normal.png
// relTexPath :
// realPath : ../MacOS/../../../data/FlightHelmet/



#ifndef TARGET_LINUX_ARM
if(bTryEmbed || ofFile::doesFileExist(realPath) == false) {
auto embeddedTexture = scene->GetEmbeddedTexture(ogPath.c_str());
if( embeddedTexture ){
bHasEmbeddedTexture = true;
ofLogVerbose("ofxAssimpModelLoader") << "loadGLResource() texture " << texFile << " is embedded ";
ofLogVerbose("ofxAssimpModelLoader") << "loadGLResource() texture " << realPath.filename() << " is embedded ";
}else{
ofLogError("ofxAssimpModelLoader") << "loadGLResource(): texture doesn't exist: \""
<< file.getFileName() + "\" in \"" << realPath << "\"";
<< file.getFileName() + "\" in \"" << realPath.string() << "\"";
}
}
#endif
Expand All @@ -419,7 +435,7 @@ void ofxAssimpModelLoader::loadGLResources(){
meshHelper.addTexture(assimpTexture);

ofLogVerbose("ofxAssimpModelLoader") << "loadGLResource(): texture already loaded: \""
<< file.getFileName() + "\" from \"" << realPath << "\"" << " adding texture as " << assimpTexture.getTextureTypeAsString() ;
<< file.getFileName() + "\" from \"" << realPath.string() << "\"" << " adding texture as " << assimpTexture.getTextureTypeAsString() ;
} else {

shared_ptr<ofTexture> texture = std::make_shared<ofTexture>();
Expand Down Expand Up @@ -463,7 +479,7 @@ void ofxAssimpModelLoader::loadGLResources(){
ofLogVerbose("ofxAssimpModelLoader") << "loadGLResource(): texture " << tmpTex.getTextureTypeAsString() << " loaded, dimensions: " << texture->getWidth() << "x" << texture->getHeight();
}else{
ofLogError("ofxAssimpModelLoader") << "loadGLResource(): couldn't load texture: \""
<< file.getFileName() + "\" from \"" << realPath << "\"";
<< file.getFileName() + "\" from \"" << realPath.string() << "\"";
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion addons/ofxAssimpModelLoader/src/ofxAssimpModelLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "ofxAssimpTexture.h"
#include "ofMesh.h"
#include "ofMath.h"
#include "ofConstants.h"

#include <assimp/Importer.hpp>

Expand Down Expand Up @@ -177,7 +178,11 @@ class ofxAssimpModelLoader{
glm::mat4 modelMatrix;

std::vector<ofLight> lights;
std::map<std::string,std::shared_ptr<ofTexture>> textures;
// std::map<std::string,std::shared_ptr<ofTexture>> textures;
std::map<
of::filesystem::path,
std::shared_ptr<ofTexture>
> textures;
std::vector<ofxAssimpMeshHelper> modelMeshes;
std::vector<ofxAssimpAnimation> animations;
int currentAnimation; // DEPRECATED - to be removed with deprecated animation functions.
Expand Down
6 changes: 3 additions & 3 deletions addons/ofxAssimpModelLoader/src/ofxAssimpTexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
//

#include "ofxAssimpTexture.h"
#include "ofConstants.h"
//#include "ofConstants.h"
#include "ofLog.h"

void ofxAssimpTexture::setup(const ofTexture & texture, std::string texturePath, bool bTexRepeat) {
void ofxAssimpTexture::setup(const ofTexture & texture, const of::filesystem::path & texturePath, bool bTexRepeat) {
this->texture = texture;
if( bTexRepeat ){
this->texture.setTextureWrap(GL_REPEAT, GL_REPEAT);
Expand Down Expand Up @@ -43,7 +43,7 @@ ofTexture & ofxAssimpTexture::getTextureRef() {
return texture;
}

std::string ofxAssimpTexture::getTexturePath() {
of::filesystem::path ofxAssimpTexture::getTexturePath() {
return texturePath;
}

Expand Down
7 changes: 4 additions & 3 deletions addons/ofxAssimpModelLoader/src/ofxAssimpTexture.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@

#include "ofTexture.h"
#include <assimp/material.h>
#include "ofConstants.h"

class ofxAssimpTexture {

public:

void setup(const ofTexture & texture, std::string texturePath, bool bTexRepeat = true);
void setup(const ofTexture & texture, const of::filesystem::path & texturePath, bool bTexRepeat = true);

ofTexture & getTextureRef();
std::string getTexturePath();
of::filesystem::path getTexturePath();
bool hasTexture();

void setTextureType(aiTextureType aTexType);
Expand All @@ -27,7 +28,7 @@ class ofxAssimpTexture {
private:

ofTexture texture;
std::string texturePath;
of::filesystem::path texturePath;
aiTextureType textureType;
std::string mTexTypeStr;
};
4 changes: 2 additions & 2 deletions addons/ofxEmscripten/src/ofxEmscriptenURLFileLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ int ofxEmscriptenURLFileLoader::getAsync(const string & url, const string & na
return req->getId();
}

ofHttpResponse ofxEmscriptenURLFileLoader::saveTo(const string & url, const std::filesystem::path & path){
ofHttpResponse ofxEmscriptenURLFileLoader::saveTo(const string & url, const of::filesystem::path & path){
saveAsync(url,path);
return ofHttpResponse();
}

int ofxEmscriptenURLFileLoader::saveAsync(const string & url, const std::filesystem::path & path){
int ofxEmscriptenURLFileLoader::saveAsync(const string & url, const of::filesystem::path & path){
ofHttpRequest * req = new ofHttpRequest(url,url,true);
#if __EMSCRIPTEN_major__>1 || (__EMSCRIPTEN_major__==1 && __EMSCRIPTEN_minor__>22)
emscripten_async_wget2(url.c_str(), path.c_str(), "GET", "", req, &onload_file_cb, &onerror_file_cb, NULL);
Expand Down
4 changes: 2 additions & 2 deletions addons/ofxEmscripten/src/ofxEmscriptenURLFileLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class ofxEmscriptenURLFileLoader: public ofBaseURLFileLoader {
virtual ~ofxEmscriptenURLFileLoader();
ofHttpResponse get(const std::string & url);
int getAsync(const std::string & url, const std::string & name=""); // returns id
ofHttpResponse saveTo(const std::string & url, const std::filesystem::path & path);
int saveAsync(const std::string & url, const std::filesystem::path & path);
ofHttpResponse saveTo(const std::string & url, const of::filesystem::path & path);
int saveAsync(const std::string & url, const of::filesystem::path & path);
ofHttpResponse handleRequest(const ofHttpRequest & request);
int handleRequestAsync(const ofHttpRequest & request);
void remove(int id);
Expand Down
3 changes: 2 additions & 1 deletion addons/ofxGui/src/ofxSliderGroup.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "ofxSliderGroup.h"
using namespace std;

using std::string;

template<class VecType>
ofxVecSlider_<VecType>::ofxVecSlider_(ofParameter<VecType> value, float width, float height){
Expand Down
2 changes: 1 addition & 1 deletion addons/ofxOpenCv/src/ofxCvHaarFinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void ofxCvHaarFinder::setup(std::string haarFile) {

this->haarFile = haarFile;

haarFile = ofToDataPath(haarFile);
haarFile = ofToDataPath(haarFile).string();
#ifdef USE_OLD_CV
if(cascade != NULL)
cvReleaseHaarClassifierCascade(&cascade);
Expand Down
8 changes: 4 additions & 4 deletions addons/ofxPoco/src/ofxXmlPoco.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ ofxXmlPoco::ofxXmlPoco(){
}


bool ofxXmlPoco::load(const std::filesystem::path & path){
ofFile file(path, ofFile::ReadOnly);
bool ofxXmlPoco::load(const of::filesystem::path & filePath){
ofFile file(filePath, ofFile::ReadOnly);
if(!file.exists()){
ofLogError("ofxXmlPoco") << "couldn't load, \"" << file.getFileName() << "\" not found";
return false;
Expand All @@ -53,10 +53,10 @@ bool ofxXmlPoco::load(const std::filesystem::path & path){
}


bool ofxXmlPoco::save(const std::filesystem::path & path){
bool ofxXmlPoco::save(const of::filesystem::path & filePath){
ofBuffer buffer;
buffer.set(toString());
ofFile file(path, ofFile::WriteOnly);
ofFile file(filePath, ofFile::WriteOnly);
return file.writeFromBuffer(buffer);
}

Expand Down
4 changes: 2 additions & 2 deletions addons/ofxPoco/src/ofxXmlPoco.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class ofxXmlPoco{
ofxXmlPoco( const ofxXmlPoco& rhs );
const ofxXmlPoco& operator =( const ofxXmlPoco& rhs );

bool load(const std::filesystem::path & path);
bool save(const std::filesystem::path & path);
bool load(const of::filesystem::path & filePath);
bool save(const of::filesystem::path & filePath);

bool addChild( const std::string& path );
void addXml( ofxXmlPoco& xml, bool copyAll = false);
Expand Down
5 changes: 3 additions & 2 deletions addons/ofxSvg/src/ofxSvg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
#include "ofConstants.h"
#include <locale>

using namespace std;
using std::string;
using std::vector;

extern "C"{
#include "svgtiny.h"
Expand All @@ -27,7 +28,7 @@ ofPath & ofxSvg::getPathAt(int n){
}

void ofxSvg::load(std::string path){
path = ofToDataPath(path);
path = ofToDataPath(path).string();

if(path.compare("") == 0){
ofLogError("ofxSVG") << "load(): path does not exist: \"" << path << "\"";
Expand Down
3 changes: 3 additions & 0 deletions addons/ofxThreadedImageLoader/src/ofxThreadedImageLoader.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#include "ofxThreadedImageLoader.h"
#include <sstream>

using std::string;

ofxThreadedImageLoader::ofxThreadedImageLoader(){
nextID = 0;
ofAddListener(ofEvents().update, this, &ofxThreadedImageLoader::update);
Expand Down
7 changes: 3 additions & 4 deletions addons/ofxThreadedImageLoader/src/ofxThreadedImageLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
#include "ofTypes.h"
#include "ofThreadChannel.h"


using namespace std;
using std::string;

class ofxThreadedImageLoader : public ofThread {
public:
Expand Down Expand Up @@ -40,12 +39,12 @@ class ofxThreadedImageLoader : public ofThread {
};


typedef map<string, ofImageLoaderEntry>::iterator entry_iterator;
typedef std::map<string, ofImageLoaderEntry>::iterator entry_iterator;

int nextID;
int lastUpdate;

map<string,ofImageLoaderEntry> images_async_loading; // keeps track of images which are loading async
std::map<string,ofImageLoaderEntry> images_async_loading; // keeps track of images which are loading async
ofThreadChannel<ofImageLoaderEntry> images_to_load_from_disk;
ofThreadChannel<ofImageLoaderEntry> images_to_update;
};
Expand Down
4 changes: 2 additions & 2 deletions addons/ofxUnitTests/src/ofxUnitTests.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ class ofxUnitTestsApp: public ofBaseApp{
const std::string APPVEYOR_API_URL = "APPVEYOR_API_URL";
if(ofGetEnv(APPVEYOR_API_URL)!=""){
//ofSystem("appveyor AddTest -Name " + projectName.string() + " -Framework ofxUnitTests -FileName " + exeName.string() + " -Outcome " + (passed?"Passed":"Failed") + " -Duration " + ofToString(now-then));
auto projectDir = std::filesystem::canonical(std::filesystem::path(ofFilePath::getCurrentExeDir()) / "..");
auto projectDir = of::filesystem::canonical(of::filesystem::path(ofFilePath::getCurrentExeDir()) / "..");
auto projectName = projectDir.stem();
auto exeName = std::filesystem::path(ofFilePath::getCurrentExePath()).filename();
auto exeName = of::filesystem::path(ofFilePath::getCurrentExePath()).filename();
auto stdOut = logger->getStdOut();
ofStringReplace(stdOut, "\\", "\\\\");
ofStringReplace(stdOut, "\"", "\\\"");
Expand Down
10 changes: 5 additions & 5 deletions addons/ofxXmlSettings/src/ofxXmlSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ ofxXmlSettings::ofxXmlSettings(const string& xmlFile):
//we do this so that we have a valid handle
//without the need for loadFile
storedHandle = TiXmlHandle(&doc);
loadFile(xmlFile);
load(xmlFile);
}

//---------------------------------------------------------
Expand All @@ -73,8 +73,8 @@ void ofxXmlSettings::clear(){

//---------------------------------------------------------
bool ofxXmlSettings::load(const string& xmlFile){
string fullXmlFile = ofToDataPath(xmlFile);
bool loadOkay = doc.LoadFile(fullXmlFile);
auto fullXmlFile = ofToDataPath(xmlFile);
bool loadOkay = doc.LoadFile(fullXmlFile.string());

//theo removed bool check as it would
//return false if the file exists but was
Expand All @@ -89,8 +89,8 @@ bool ofxXmlSettings::load(const string& xmlFile){

//---------------------------------------------------------
bool ofxXmlSettings::save(const string& xmlFile){
string fullXmlFile = ofToDataPath(xmlFile);
return doc.SaveFile(fullXmlFile);
auto fullXmlFile = ofToDataPath(xmlFile);
return doc.SaveFile(fullXmlFile.string());
}

//---------------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion addons/ofxXmlSettings/src/ofxXmlSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "tinyxml.h"
#endif

using namespace std;

/*
Q: what is the which = 0 argument?
Expand Down
2 changes: 1 addition & 1 deletion addons/ofxiOS/src/core/ofxiOSAppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application {
currentScreenIndex = 0;

// set the root application path
ofSetDataPathRoot([[NSString stringWithFormat:@"%@/", [[NSBundle mainBundle] resourcePath]] cStringUsingEncoding:NSUTF8StringEncoding]);
ofSetDataPathRoot(of::filesystem::path([[NSString stringWithFormat:@"%@/", [[NSBundle mainBundle] resourcePath]] cStringUsingEncoding:NSUTF8StringEncoding]));

// show or hide status bar depending on OF_WINDOW or OF_FULLSCREEN
[[UIApplication sharedApplication] setStatusBarHidden:(ofxiOSGetOFWindow()->getWindowMode() == OF_FULLSCREEN)];
Expand Down
2 changes: 1 addition & 1 deletion addons/ofxiOS/src/sound/ofxOpenALSoundPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ ofxOpenALSoundPlayer::~ofxOpenALSoundPlayer() {

//--------------------------------------------------------------

bool ofxOpenALSoundPlayer::load(const std::filesystem::path& filePath, bool stream) {
bool ofxOpenALSoundPlayer::load(const of::filesystem::path& filePath, bool stream) {

if(!SoundEngineInitialized) {
ofxOpenALSoundPlayer::initializeSoundEngine();
Expand Down
2 changes: 1 addition & 1 deletion addons/ofxiOS/src/sound/ofxOpenALSoundPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class ofxOpenALSoundPlayer : public ofBaseSoundPlayer{
ofxOpenALSoundPlayer();
~ofxOpenALSoundPlayer();

bool load(const std::filesystem::path& fileName, bool stream=false);
bool load(const of::filesystem::path& fileName, bool stream=false);
void unload();

void play();
Expand Down
2 changes: 1 addition & 1 deletion addons/ofxiOS/src/sound/ofxiOSSoundPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ofxiOSSoundPlayer : public ofBaseSoundPlayer {
ofxiOSSoundPlayer();
~ofxiOSSoundPlayer();

bool load(const std::filesystem::path& fileName, bool stream = false);
bool load(const of::filesystem::path& fileName, bool stream = false);
void unload();
void play();
void stop();
Expand Down
Loading