diff Core/Toolbox.cpp @ 803:4689e400e0fa

directory to store the results of the unit tests
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 07 May 2014 09:29:11 +0200
parents ecedd89055db
children 8ce2f69436ca
line wrap: on
line diff
--- a/Core/Toolbox.cpp	Tue May 06 17:09:32 2014 +0200
+++ b/Core/Toolbox.cpp	Wed May 07 09:29:11 2014 +0200
@@ -824,5 +824,23 @@
     }
   }
 
+
+  void Toolbox::CreateDirectory(const std::string& path)
+  {
+    if (boost::filesystem::exists(path))
+    {
+      if (!boost::filesystem::is_directory(path))
+      {
+        throw OrthancException("Cannot create the directory over an existing file: " + path);
+      }
+    }
+    else
+    {
+      if (!boost::filesystem::create_directories(path))
+      {
+        throw OrthancException("Unable to create the directory: " + path);
+      }
+    }
+  }
 }