#include <DbmFileLocater.h>
Public Member Functions | |
| DbmFileLocater () | |
| virtual | ~DbmFileLocater () |
| std::string | Find (const std::string &fileName) const |
Public Attributes | |
| std::list< std::string > | fDirectories |
|
|
Definition at line 39 of file DbmFileLocater.cxx. References gSystem(), LEA_CTOR, and MSG. 00040 {
00041 //
00042 //
00043 // Purpose: Default constructor
00044 //
00045 // Arguments: None.
00046 //
00047 // Return: n/a
00048 //
00049 // Contact: N. West
00050 //
00051 // Specification:-
00052 // =============
00053 //
00054 // o Create a DbmFileLocater.
00055
00056
00057 // Program Notes:-
00058 // =============
00059
00060 // None.
00061
00062 LEA_CTOR //Leak Checker
00063
00064 MSG("Dbm", Msg::kVerbose) << "Creating DbmFileLocater" << endl;
00065
00066
00067 // Put current directory first in list.
00068 fDirectories.push_back(".");
00069
00070 // Look up SRT private and public names and add them if defined.
00071 const char* str = gSystem->Getenv("SRT_PRIVATE_CONTEXT");
00072 if ( str ) fDirectories.push_back(str);
00073 str = gSystem->Getenv("SRT_PUBLIC_CONTEXT");
00074 if ( str ) fDirectories.push_back(str);
00075
00076 }
|
|
|
Definition at line 80 of file DbmFileLocater.cxx. 00080 {
00081 //
00082 //
00083 // Purpose: Destructor
00084 //
00085 // Arguments:
00086 // None.
00087 //
00088 // Return: n/a
00089 //
00090 // Contact: N. West
00091 //
00092 // Specification:-
00093 // =============
00094 //
00095 // o Destroy DbmFileLocater.
00096
00097
00098 // Program Notes:-
00099 // =============
00100
00101 // None.
00102
00103 LEA_DTOR //Leak Checker
00104
00105 MSG("Dbm", Msg::kVerbose) << "Destroying DbmFileLocater" << endl;
00106
00107 }
|
|
|
Definition at line 111 of file DbmFileLocater.cxx. References fDirectories, and MSG. Referenced by DbmModule::Help(), and DbmValidate::PrepareDb(). 00111 {
00112 //
00113 //
00114 // Purpose: Attempt to find file in set of directories.
00115 //
00116 // Arguments:
00117 // fileName in File name, possibly with relative directory
00118 // e.g. DatabaseMaintenance/doc/Help.txt
00119 //
00120 // Return: Full ressolved file name or "" if not found.
00121 //
00122 // Contact: N. West
00123 //
00124 // Specification:-
00125 // =============
00126 //
00127 // o Search in order through fDirectories, appending each in turn
00128 // for required file.
00129
00130 // Program Notes:-
00131 // =============
00132
00133 // None.
00134
00135 for (list<string>::const_iterator itr = fDirectories.begin();
00136 itr != fDirectories.end();
00137 ++itr) {
00138 string fName = *itr + "/" + fileName;
00139 ifstream test(fName.c_str());
00140 if ( test.is_open() ) return fName;
00141 }
00142
00143 MSG("Dbm",Msg::kInfo) << "Cannot find file " << fileName << endl;
00144 return "";
00145
00146 }
|
|
|
Definition at line 42 of file DbmFileLocater.h. Referenced by Find(). |
1.3.9.1