Permalink
Browse files

Merge pull request #734 from elliotwoods/ofToDataPath

kyle's suggestion of dealing with ofDataPath
  • Loading branch information...
arturoc committed Sep 11, 2011
2 parents fca449d + 00550a6 commit 666c8695a730059bc6017f99e76a2d43c00b68dd
Showing with 8 additions and 10 deletions.
  1. +0 −10 libs/openFrameworks/app/ofAppRunner.cpp
  2. +8 −0 libs/openFrameworks/utils/ofUtils.cpp
@@ -60,11 +60,6 @@ void ofRunApp(ofBaseApp * OFSA){
OFSAptr->mouseY = 0;
}
- #ifdef TARGET_OSX
- //this internally checks the executable path for osx
- ofSetDataPathRoot("../../../data/");
- #endif
-
atexit(ofExitCallback);
#ifdef WIN32_HIGH_RES_TIMING
@@ -160,11 +155,6 @@ void ofRunApp(ofPtr<ofBaseApp> OFSA){
OFSAptr->mouseY = 0;
}
- #ifdef TARGET_OSX
- //this internally checks the executable path for osx
- ofSetDataPathRoot("../../../data/");
- #endif
-
atexit(ofExitCallback);
#ifdef WIN32_HIGH_RES_TIMING
@@ -213,6 +213,8 @@ void ofDisableDataPath(){
static string dataPathRoot = "data/";
#endif
+static bool isDataPathSet = false;
+
//--------------------------------------------------
void ofSetDataPathRoot(string newRoot){
string newPath = "";
@@ -248,11 +250,17 @@ void ofSetDataPathRoot(string newRoot){
}
#endif
#endif
+
dataPathRoot = newRoot;
+ isDataPathSet = true;
}
//--------------------------------------------------
string ofToDataPath(string path, bool makeAbsolute){
+
+ if (!isDataPathSet)
+ ofSetDataPathRoot(dataPathRoot);
+
if( enableDataPath ){
//check if absolute path has been passed or if data path has already been applied

0 comments on commit 666c869

Please sign in to comment.