diff options
Diffstat (limited to 'lib/Utils/DebugDump.cpp')
-rw-r--r-- | lib/Utils/DebugDump.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/lib/Utils/DebugDump.cpp b/lib/Utils/DebugDump.cpp index 5386162..302d3be 100644 --- a/lib/Utils/DebugDump.cpp +++ b/lib/Utils/DebugDump.cpp @@ -20,7 +20,6 @@ */ #include "DebugDump.h" -#include "Packages.h" #include <fstream> #include <iostream> #include <sstream> @@ -30,7 +29,6 @@ #include <sys/utsname.h> #include <limits.h> #include <fcntl.h> -#include <sys/procfs.h> #include <ctype.h> #include <time.h> #include <unistd.h> @@ -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(); } |