From 72ef5336c82cd667332d726a6d6432e7ec8e677c Mon Sep 17 00:00:00 2001 From: Zdenek Prikryl Date: Thu, 19 Feb 2009 14:31:19 +0100 Subject: new delete function --- lib/Utils/DebugDump.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'lib/Utils/DebugDump.cpp') diff --git a/lib/Utils/DebugDump.cpp b/lib/Utils/DebugDump.cpp index 53861622..302d3be3 100644 --- a/lib/Utils/DebugDump.cpp +++ b/lib/Utils/DebugDump.cpp @@ -20,7 +20,6 @@ */ #include "DebugDump.h" -#include "Packages.h" #include #include #include @@ -30,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -144,13 +142,12 @@ void CDebugDump::Create(const std::string& pDir) SaveTime(); } -void CDebugDump::Delete(const std::string& pDir) +void CDebugDump::DeleteFileDir(const std::string& pDir) { if (!ExistFileDir(pDir)) { return; } - Lock(); DIR *dir = opendir(pDir.c_str()); std::string fullPath; struct dirent *dent = NULL; @@ -163,20 +160,30 @@ void CDebugDump::Delete(const std::string& pDir) fullPath = pDir + "/" + dent->d_name; if (dent->d_type == DT_DIR) { - Delete(fullPath); + DeleteFileDir(fullPath); } if (remove(fullPath.c_str()) == -1) { - throw "CDebugDump::DeleteDir(): Cannot remove file: " + fullPath; + throw "CDebugDump::DeleteFileDir(): Cannot remove file: " + fullPath; } } } closedir(dir); if (remove(pDir.c_str()) == -1) { - throw "CDebugDump::DeleteDir(): Cannot remove dir: " + fullPath; + throw "CDebugDump::DeleteFileDir(): Cannot remove dir: " + fullPath; } } +} + +void CDebugDump::Delete() +{ + if (!ExistFileDir(m_sDebugDumpDir)) + { + return; + } + Lock(); + DeleteFileDir(m_sDebugDumpDir); UnLock(); } -- cgit