fixed: the core didn't test for special folder when system was running

(now mkdir addes correctly special folders)
added: function 'reload'
       param: 'templates' - reloading templates


git-svn-id: svn://ttmath.org/publicrep/cmslu/trunk@519 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2009-11-16 17:43:23 +00:00
parent 9129f1b82a
commit c62d48160a
13 changed files with 123 additions and 29 deletions

View File

@@ -11,6 +11,9 @@
#include "log.h"
std::string DirContainer::dir_etc = "etc";
DirContainer::DirContainer()
{
is_root = false;
@@ -62,10 +65,9 @@ bool DirContainer::Empty()
// looking for '/etc'
// 'root' is found beforehand
// CheckSpecialFolder() may not find everything (when the first is a special folder and then the root)
void DirContainer::FindSpecialFolders()
{
static std::string etc = "etc";
is_etc = false;
if( !is_root )
@@ -75,7 +77,7 @@ static std::string etc = "etc";
for( ; i!=ParentEnd() ; i = NextParent(i) )
{
if( i->second->url == etc )
if( i->second->url == dir_etc )
{
is_etc = true;
etc_iter = i->second;
@@ -85,6 +87,27 @@ static std::string etc = "etc";
}
// this is used with PushBack() method
void DirContainer::CheckSpecialFolder(const Item & item, Iterator iter)
{
if( item.parent_id == -1 )
{
is_root = true;
root_iter = iter;
}
if( !is_root )
return;
if( item.parent_id==root_iter->id && item.url==dir_etc )
{
is_etc = true;
etc_iter = iter;
log << log1 << "DirCont: added special folder: /etc" << logend;
}
}
DirContainer::Iterator DirContainer::PushBack(const Item & item)
{
if( item.parent_id == -1 && is_root )
@@ -94,12 +117,7 @@ DirContainer::Iterator DirContainer::PushBack(const Item & item)
}
Iterator last_iter = table.insert(table.end(), item);
if( item.parent_id == -1 )
{
is_root = true;
root_iter = last_iter;
}
CheckSpecialFolder(item, last_iter);
log << log2 << "DirCont: added dir, url: " << item.url << ", id: " << item.id << ", parent_id: " << item.parent_id << logend;