Directory
// mkdir
#using <mscorlib.dll>
#using <System.dll>
using namespace System;
using namespace System::IO;
using namespace System::Text;
#ifndef EXIT_FAILURE
#define EXIT_FAILURE 1
#endif
#ifndef EXIT_SUCCESS
#define EXIT_SUCCESS 0
#endif
void ErrorQuit( Exception^ e, String^ msg){
TextWriter^ errorWriter = Console::Error;
errorWriter->WriteLine( e->Message );
errorWriter->WriteLine( msg );
System::Environment::Exit(EXIT_FAILURE);
}
void prepareDir(System::String^ dir){
DirectoryInfo^ di = gcnew DirectoryInfo( dir );
try {
//Determine whether the directory exists.
if ( !di->Exists ) {
di->Create();
}
} catch (IOException^ e){
ErrorQuit(e,"The directory cannot be created. ");
} finally{
if ( di ) delete di;
}
return;
}