From c78d4ad16111518221a7a7980141670baa932378 Mon Sep 17 00:00:00 2001 From: Marco De Marco <demarco@oats.inaf.it> Date: Fri, 5 Sep 2014 15:04:24 +0200 Subject: [PATCH] File folder permission denied fix --- src/FileWrapper.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/FileWrapper.cpp b/src/FileWrapper.cpp index f1daba1..f53e764 100644 --- a/src/FileWrapper.cpp +++ b/src/FileWrapper.cpp @@ -25,8 +25,15 @@ FileWrapper::FileWrapper(Tango::DeviceImpl* deviceImpl_p, m_outputFilePath /= fileStream.str(); - if(!boost::filesystem::exists(m_outputFilePath)) + try + { + if(!boost::filesystem::exists(m_outputFilePath)) boost::filesystem::create_directories(m_outputFilePath); + } + catch(boost::filesystem::filesystem_error& ex) + { + throw std::logic_error(ex.what()); + } if(!boost::filesystem::is_directory(m_outputFilePath)) throw std::logic_error("Destination path \'" @@ -152,7 +159,7 @@ void FileWrapper::cleanUp() m_outputFileStream.close(); boost::system::error_code errorCode; - + if(boost::filesystem::exists(m_outputFilePath)) boost::filesystem::remove(m_outputFilePath, errorCode); } -- GitLab