From b34d6d335ac6641a91645964ecb850e84a54d761 Mon Sep 17 00:00:00 2001 From: Zdenek Prikryl Date: Wed, 4 Feb 2009 17:02:02 +0100 Subject: Better check for existing files/dirs --- lib/DebugDump/DebugDump.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'lib/DebugDump/DebugDump.cpp') diff --git a/lib/DebugDump/DebugDump.cpp b/lib/DebugDump/DebugDump.cpp index 4e3c667e..e35ec4dd 100644 --- a/lib/DebugDump/DebugDump.cpp +++ b/lib/DebugDump/DebugDump.cpp @@ -39,13 +39,20 @@ 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."; } } 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; } -- cgit