19 #ifndef itkFileTools_h
20 #define itkFileTools_h
49 #include "itksys/SystemTools.hxx"
59 if (dir.empty() || itksys::SystemTools::FileExists(dir.c_str(),
true))
61 ExceptionObject eo(__FILE__, __LINE__,
"directory cannot be created");
67 if (dir.empty() ||
"." == dir || itksys::SystemTools::FileIsDirectory(dir.c_str()))
73 itksys::SystemTools::MakeDirectory(dir.c_str());
76 if (!itksys::SystemTools::FileIsDirectory(dir.c_str()))
78 ExceptionObject eo(__FILE__, __LINE__,
"directory cannot be created");
87 if (fn.empty() || itksys::SystemTools::FileIsDirectory(fn.c_str()))
89 ExceptionObject eo(__FILE__, __LINE__,
"file cannot be created");
95 if (itksys::SystemTools::FileExists(fn.c_str(),
true))
101 std::string dir = itksys::SystemTools::GetFilenamePath(fn.c_str());
105 itksys::SystemTools::Touch(fn.c_str(),
true);
108 if (!itksys::SystemTools::FileExists(fn.c_str(),
true))
110 ExceptionObject eo(__FILE__, __LINE__,
"file cannot be created");
117 #endif // itkFileTools_h