Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

PathTest.h

Go to the documentation of this file.
00001 /* Copyright (C) 2002 Carsten Griwodz 00002 * 00003 * You are allowed to use all other parts of the code under the following terms: 00004 * 00005 * For non-commercial use, this code may be used in unmodified form 00006 * provided that this copyright notice and this permission notice appear 00007 * in supporting documentation. 00008 * 00009 * The code may be made subject to the terms of the GNU General Public 00010 * License, Version 2, and re-distributed under the terms of this license. 00011 * 00012 * Commercial use other than under the terms of the GNU General Public 00013 * License is allowed only after negotiation of conditions with the authors. 00014 */ 00015 #ifndef OS_PATH_TEST_H 00016 #define OS_PATH_TEST_H 00017 00018 #include <list> 00019 #include "MNString.h" 00020 00021 using std::list; 00022 00023 class PathTest; 00024 00038 class AbsPath 00039 { 00040 public: 00041 enum Mode 00042 { 00043 Executable 00044 }; 00045 00046 private: 00047 MNString _filename; 00048 Mode _mode; 00049 MNString _abs_filename; 00050 PathTest* _path_test; 00051 bool _found; 00052 00053 public: 00071 AbsPath( const char* filename, 00072 const char* execname, 00073 Mode mode = Executable ); 00074 void prependSearchDir( const char* dirname ); 00075 void appendSearchDir( const char* dirname ); 00076 00090 bool exists( MNString& absfilename ); 00091 }; 00092 00093 class PathTest 00094 { 00095 MNString _cwd; 00096 list<MNString> _searchpath; 00097 00098 public: 00099 PathTest( const char* execname, const char* env = "PATH" ); 00100 void prependSearchDir( const char* dirname ); 00101 void appendSearchDir( const char* dirname ); 00102 bool find( MNString filename, 00103 AbsPath::Mode mode, 00104 MNString& absfilename ); 00105 00106 private: 00107 MNString makeAbsolute( MNString in ); 00108 bool accessibleDir( const MNString& in ); 00109 void private_append( MNString in ); 00110 }; 00111 00112 #endif /* OS_PATH_TEST_H */ 00113

Generated on Sun Mar 6 13:35:49 2005 for Komssys by doxygen 1.3.8