00001
00002
00003
00004 #include <sys/stat.h>
00005 #include <errno.h>
00006 #include "debug.h"
00007 #include "utils.h"
00008 #include "datetime.h"
00009 #include "filesystem.h"
00010
00011 char *getRuleBasePath(char *ruleBaseName, char rulesFileName[MAX_NAME_LEN]) {
00012 char *configDir = getConfigDir ();
00013 snprintf (rulesFileName, MAX_NAME_LEN, "%s/reConfigs/%s.re", configDir,ruleBaseName);
00014 return rulesFileName;
00015
00016 }
00017 void getResourceName(char buf[1024], char *rname) {
00018 snprintf(buf, 1024, "%s/%s", getConfigDir(), rname);
00019 char *ch = buf;
00020 while(*ch != '\0') {
00021 if(*ch == '\\' || *ch == '/') {
00022 *ch = '_';
00023 }
00024 ch++;
00025 }
00026
00027 }
00028
00029 int getModifiedTime(char *fn, time_type *timestamp) {
00030 boost::filesystem::path path(fn);
00031 time_type time = boost::filesystem::last_write_time(path);
00032 time_type_set(*timestamp, time);
00033 return 0;
00034 }