diff options
author | Zdenek Prikryl <zdeny@dhcp-lab-218.englab.brq.redhat.com> | 2009-02-04 17:02:02 +0100 |
---|---|---|
committer | Zdenek Prikryl <zdeny@dhcp-lab-218.englab.brq.redhat.com> | 2009-02-04 17:02:02 +0100 |
commit | b34d6d335ac6641a91645964ecb850e84a54d761 (patch) | |
tree | 80e1a6f54e5ec1223314bc0800511ce1937fe40b /lib/DebugDump/DebugDump.cpp | |
parent | 6cd4453533ed586faf043b38322f0699b1a58e7d (diff) | |
download | abrt-b34d6d335ac6641a91645964ecb850e84a54d761.tar.gz abrt-b34d6d335ac6641a91645964ecb850e84a54d761.tar.xz abrt-b34d6d335ac6641a91645964ecb850e84a54d761.zip |
Better check for existing files/dirs
Diffstat (limited to 'lib/DebugDump/DebugDump.cpp')
-rw-r--r-- | lib/DebugDump/DebugDump.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/DebugDump/DebugDump.cpp b/lib/DebugDump/DebugDump.cpp index 4e3c667..e35ec4d 100644 --- a/lib/DebugDump/DebugDump.cpp +++ b/lib/DebugDump/DebugDump.cpp @@ -39,7 +39,7 @@ CDebugDump::CDebugDump() : void CDebugDump::Open(const std::string& pDir) { m_sDebugDumpDir = pDir; - if (!Exist(pDir)) + if (!ExistFileDir(pDir)) { throw "CDebugDump::CDebugDump(): "+pDir+" does not exist."; } @@ -47,6 +47,13 @@ void CDebugDump::Open(const std::string& pDir) bool CDebugDump::Exist(const std::string& pPath) { + std::string fullPath = m_sDebugDumpDir + "/" + pPath; + return ExistFileDir(fullPath); +} + + +bool CDebugDump::ExistFileDir(const std::string& pPath) +{ struct stat buf; if (stat(pPath.c_str(), &buf) == 0) { @@ -66,11 +73,12 @@ void CDebugDump::Create(const std::string& pDir) { throw "CDebugDump::Create(): Cannot create dir: " + pDir; } + SaveEnvironment(); } void CDebugDump::Delete(const std::string& pDir) { - if (!Exist(pDir)) + if (!ExistFileDir(pDir)) { return; } |