+
+ std::string systemCommand;
+ std::string filenameout;
+ if (write) {
+ if (verbose)
+ std::cout << "Check for output directory :[" << dirNameout << "]."
+ <<std::endl;
+ if ( ! GDCM_NAME_SPACE::DirList::IsDirectory(dirNameout) ) // dirout not found
+ {
+ std::string strDirNameout(dirNameout); // to please gcc 4
+ systemCommand = "mkdir " +strDirNameout; // create it!
+ if (verbose)
+ std::cout << systemCommand << std::endl;
+ system (systemCommand.c_str());
+ if ( ! GDCM_NAME_SPACE::DirList::IsDirectory(dirNameout) ) // be sure it worked
+ {
+ std::cout << "KO : not a dir : [" << dirNameout << "] (creation failure ?)"
+ << std::endl;
+ return 0;
+ }
+ else
+ {
+ if (verbose)
+ std::cout << "Directory [" << dirNameout << "] created." << std::endl;
+ }
+ }
+ else
+ {
+ if (verbose)
+ std::cout << "Output Directory [" << dirNameout
+ << "] already exists; Used as is."
+ << std::endl;
+ }
+ }
+
+ // --> End of checking supposed-to-be-directory names
+