Changeset 10818 for OpenSceneGraph/trunk/src/osgDB/FileUtils.cpp
- Timestamp:
- 11/23/09 11:19:37 (3 years ago)
- Files:
-
- 1 modified
-
OpenSceneGraph/trunk/src/osgDB/FileUtils.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgDB/FileUtils.cpp
r10171 r10818 11 11 * OpenSceneGraph Public License for more details. 12 12 */ 13 14 // handle TCHAR type on various platforms 15 // #ifndef is inspired by https://svn.apache.org/repos/asf/logging/log4cxx/tags/v0_9_4/include/log4cxx/helpers/tchar.h 16 // defining type as plain char is from unzip.h, line 64 17 18 #ifndef TCHAR 19 typedef char TCHAR; 20 #endif 21 13 22 14 23 // currently this impl is for _all_ platforms, except as defined. … … 194 203 return makeDirectory( getFilePath( path )); 195 204 } 205 206 207 std::string osgDB::getCurrentWorkingDirectory( void ) 208 { 209 // MAX_PATH/cwd inspired by unzip.cpp 210 #ifndef MAX_PATH 211 #define MAX_PATH 1024 212 #endif 213 TCHAR rootdir[MAX_PATH]; 214 if(getcwd(rootdir,MAX_PATH-1)) 215 { 216 return(rootdir); 217 } 218 return(""); 219 }// osgDB::getCurrentWorkingDirectory 220 221 222 223 bool osgDB::setCurrentWorkingDirectory( const std::string &newCurrentWorkingDirectory ) 224 { 225 if (newCurrentWorkingDirectory.empty()) 226 { 227 osg::notify(osg::DEBUG_INFO) << "osgDB::setCurrentWorkingDirectory(): called with empty string." << std::endl; 228 return false; 229 } 230 231 #ifdef OSG_USE_UTF8_FILENAME 232 return _wchdir( OSGDB_STRING_TO_FILENAME(newCurrentWorkingDirectory).c_str()) == 0; 233 #else 234 return chdir( newCurrentWorkingDirectory.c_str()) == 0; 235 #endif 236 237 return true; 238 } // osgDB::setCurrentWorkingDirectory 239 240 196 241 197 242 void osgDB::convertStringPathIntoFilePathList(const std::string& paths,FilePathList& filepath)
