OpenSceneGraph/include/osgDB/FileUtils

54 lines
1.7 KiB
Plaintext
Raw Normal View History

//C++ header - Open Scene Graph - Copyright (C) 1998-2001 Robert Osfield
//Distributed under the terms of the GNU Library General Public License (LGPL)
//as published by the Free Software Foundation.
#ifndef OSGDB_FILEUTILS
#define OSGDB_FILEUTILS 1
#include <osgDB/Export>
#include <vector>
#include <string>
namespace osgDB {
/** initialize the data file path,
* uses OSGFILEPATH environmental
* variable to defined.*/
OSGDB_EXPORT extern void initFilePath( void );
/** set the data file path.*/
OSGDB_EXPORT extern void setFilePath( const char *_path );
/** set the data file path.*/
OSGDB_EXPORT extern const char* getFilePath();
2001-10-24 21:46:58 +08:00
/** find specified file if specified file path.*/
OSGDB_EXPORT extern char *findFileInPath( const char *_file, const char * filePath );
2001-10-24 21:46:58 +08:00
/** find specified file on the set data file path.*/
OSGDB_EXPORT extern char *findFile( const char *file );
/** find specified dso/dll.*/
OSGDB_EXPORT extern char *findDSO( const char *name );
/** simple list of names to represent a directory's contents. */
typedef std::vector<std::string> DirectoryContents;
/** return the directory/filename of a file if its is contained within specified directory.
* return "" if directory does not contain file. If caseInsensitive is set to true then
2001-09-28 20:36:40 +08:00
* a case insensitive comparison is used to compare fileName to directory contents.
* This is useful when unix programs attempt read case insentive windows filenames.
*/
OSGDB_EXPORT extern std::string findFileInDirectory(const std::string& fileName,const std::string& dirName,bool caseInsensitive=false);
/** return the contents of a directory.
* returns an empty array on any error.*/
OSGDB_EXPORT extern DirectoryContents getDirectoryContents(const std::string& dirName);
};
#endif