Skip to content

Commit

Permalink
Merge pull request openframeworks#734 from elliotwoods/ofToDataPath
Browse files Browse the repository at this point in the history
kyle's suggestion of dealing with ofDataPath
  • Loading branch information
arturoc committed Sep 11, 2011
2 parents fca449d + 00550a6 commit 666c869
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
10 changes: 0 additions & 10 deletions libs/openFrameworks/app/ofAppRunner.cpp
Expand Up @@ -60,11 +60,6 @@ void ofRunApp(ofBaseApp * OFSA){
OFSAptr->mouseY = 0; OFSAptr->mouseY = 0;
} }


#ifdef TARGET_OSX
//this internally checks the executable path for osx
ofSetDataPathRoot("../../../data/");
#endif

atexit(ofExitCallback); atexit(ofExitCallback);


#ifdef WIN32_HIGH_RES_TIMING #ifdef WIN32_HIGH_RES_TIMING
Expand Down Expand Up @@ -160,11 +155,6 @@ void ofRunApp(ofPtr<ofBaseApp> OFSA){
OFSAptr->mouseY = 0; OFSAptr->mouseY = 0;
} }


#ifdef TARGET_OSX
//this internally checks the executable path for osx
ofSetDataPathRoot("../../../data/");
#endif

atexit(ofExitCallback); atexit(ofExitCallback);


#ifdef WIN32_HIGH_RES_TIMING #ifdef WIN32_HIGH_RES_TIMING
Expand Down
8 changes: 8 additions & 0 deletions libs/openFrameworks/utils/ofUtils.cpp
Expand Up @@ -213,6 +213,8 @@ void ofDisableDataPath(){
static string dataPathRoot = "data/"; static string dataPathRoot = "data/";
#endif #endif


static bool isDataPathSet = false;

//-------------------------------------------------- //--------------------------------------------------
void ofSetDataPathRoot(string newRoot){ void ofSetDataPathRoot(string newRoot){
string newPath = ""; string newPath = "";
Expand Down Expand Up @@ -248,11 +250,17 @@ void ofSetDataPathRoot(string newRoot){
} }
#endif #endif
#endif #endif

dataPathRoot = newRoot; dataPathRoot = newRoot;
isDataPathSet = true;
} }


//-------------------------------------------------- //--------------------------------------------------
string ofToDataPath(string path, bool makeAbsolute){ string ofToDataPath(string path, bool makeAbsolute){

if (!isDataPathSet)
ofSetDataPathRoot(dataPathRoot);

if( enableDataPath ){ if( enableDataPath ){


//check if absolute path has been passed or if data path has already been applied //check if absolute path has been passed or if data path has already been applied
Expand Down

0 comments on commit 666c869

Please sign in to comment.