00001
00002
00003
00004
00005
00006
00007 #include "wvtclstring.h"
00008 #include "strutils.h"
00009 #include "wvfile.h"
00010 #include "wvmoniker.h"
00011 #include "wvdiriter.h"
00012 #include "unifiletreegen.h"
00013
00014 UniConfFileTreeGen::UniConfFileTreeGen(WvStringParm _basedir, WvStringParm _moniker) :
00015 basedir(_basedir), moniker(_moniker), log(_basedir, WvLog::Info)
00016 {
00017 log(WvLog::Notice,
00018 "Creating a new FileTree based on '%s'.\n", basedir);
00019 }
00020
00021 bool UniConfFileTreeGen::refresh()
00022 {
00023
00024
00025
00026 WvDirIter i(basedir, true);
00027
00028
00029 for (i.rewind(); i.next();)
00030 {
00031 WvString filename = i->fullname;
00032 WvString unikey = i->relname;
00033
00034 log(WvLog::Debug1, WvString("Checking if %s exists already.\n", unikey));
00035
00036 if (!exists(unikey))
00037 {
00038 log(WvLog::Notice, WvString("%s doesn't exists!\n", unikey));
00039 WvString mountstring("%s:%s",moniker,filename);
00040 log(WvLog::Notice, WvString("Mounting with: %s", mountstring));
00041 mount(unikey, mountstring, true);
00042 }
00043 }
00044
00045 UniMountTreeGen::refresh();
00046 return true;
00047 }
00048
00049