Commit 1287f61b authored by Sebastien Petitdemange's avatar Sebastien Petitdemange Committed by Sebastien Petitdemange
Browse files

Create last saving directory if not exist

parent 052373f9
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#ifdef __linux__ #ifdef __linux__
#include <dirent.h> #include <dirent.h>
#include <sys/statvfs.h> #include <sys/statvfs.h>
#else
#include <direct.h>
#endif #endif
#include "CtSaving.h" #include "CtSaving.h"
...@@ -1615,7 +1617,11 @@ void CtSaving::SaveContainer::close() ...@@ -1615,7 +1617,11 @@ void CtSaving::SaveContainer::close()
/** @brief check if all file can be written /** @brief check if all file can be written
*/ */
#ifdef WIN32
#define CTSAVING_MKDIR(a,b) _mkdir(a)
#else
#define CTSAVING_MKDIR(a,b) mkdir(a,b)
#endif
void CtSaving::Stream::checkWriteAccess() void CtSaving::Stream::checkWriteAccess()
{ {
DEB_MEMBER_FUNCT(); DEB_MEMBER_FUNCT();
...@@ -1646,11 +1652,13 @@ void CtSaving::Stream::checkWriteAccess() ...@@ -1646,11 +1652,13 @@ void CtSaving::Stream::checkWriteAccess()
THROW_CTL_ERROR(Error) << output; THROW_CTL_ERROR(Error) << output;
} }
} }
else else if(CTSAVING_MKDIR(m_pars.directory.c_str(),0777))
{ {
output = "Directory : " + m_pars.directory + " doesn't exist"; output = "Directory : " + m_pars.directory + " can't be created";
THROW_CTL_ERROR(Error) << output; THROW_CTL_ERROR(Error) << output;
} }
else // Creation was successful don't need to test other thing
return;
// test all file is mode == Abort // test all file is mode == Abort
if(m_pars.overwritePolicy == Abort) if(m_pars.overwritePolicy == Abort)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment