12 #include <sys/types.h>
34 struct dirent *dirp = NULL;
35 if((dp = opendir(path.c_str())) == NULL) {
36 LOG(
"System",
pERROR) <<
"Can not open directory: " << path;
39 while ((dirp = readdir(dp)) != NULL) {
40 string filename = path +
"/" + string(dirp->d_name);
42 if(extension.size()==0) match=
true;
46 if(filenamev.size()==0)
break;
47 string file_extension = filenamev[filenamev.size()-1];
48 match = (file_extension.find(extension) != string::npos);
51 files.push_back(filename);
62 assert(vrs.size() == 3);
63 return atoi(vrs[0].c_str());
69 assert(vrs.size() == 3);
70 return atoi(vrs[1].c_str());
76 assert(vrs.size() == 3);
77 return atoi(vrs[2].c_str());
82 if(filename.size() == 0)
return false;
84 bool is_accessible = ! (gSystem->AccessPathName(filename.c_str()));
85 if (is_accessible)
return true;
96 if( stat( path, &info ) != 0 ) {
98 }
else if(info.st_mode & S_IFDIR) {
109 time_t now = time(0);
110 tm* local_time = localtime(&now);
112 int yr = local_time->tm_year + 1900;
113 int mon = local_time->tm_mon + 1;
114 int day = local_time->tm_mday;
115 int hr = local_time->tm_hour + 1;
116 int min = local_time->tm_min;
117 int sec = local_time->tm_sec;
120 if(local_time->tm_isdst > 0)
133 if(mon == 1 || mon == 3 || mon == 5 ||
134 mon == 7 || mon == 8 || mon == 10 || mon == 12)
151 string local_time_as_string =
152 Form(format.c_str(),yr,mon,day,hr,min,sec);
154 return local_time_as_string;
int GenieMajorVrsNum(string tag)
bool FileExists(string filename)
vector< string > GetAllFilesInPath(string path, string extension="")
int GenieMinorVrsNum(string tag)
string LocalTimeAsString(string format)
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
vector< string > Split(string input, string delim)
bool DirectoryExists(const char *path)
int GenieRevisVrsNum(string tag)