MCPcopy Create free account
hub / github.com/OpenFOAM/OpenFOAM-dev / mkDir

Function mkDir

src/OSspecific/POSIX/POSIX.C:297–450  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

295
296
297bool Foam::mkDir(const fileName& pathName, mode_t mode)
298{
299 if (POSIX::debug)
300 {
301 Pout<< FUNCTION_NAME << " : pathName:" << pathName << " mode:" << mode
302 << endl;
303 if ((POSIX::debug & 2) && !Pstream::master())
304 {
305 error::printStack(Pout);
306 }
307 }
308
309 // empty names are meaningless
310 if (pathName.empty())
311 {
312 return false;
313 }
314
315 // Construct instance path directory if does not exist
316 if (::mkdir(pathName.c_str(), mode) == 0)
317 {
318 // Directory made OK so return true
319 return true;
320 }
321 else
322 {
323 switch (errno)
324 {
325 case EPERM:
326 {
327 FatalErrorInFunction
328 << "The filesystem containing " << pathName
329 << " does not support the creation of directories."
330 << exit(FatalError);
331
332 return false;
333 }
334
335 case EEXIST:
336 {
337 // Directory already exists so simply return true
338 return true;
339 }
340
341 case EFAULT:
342 {
343 FatalErrorInFunction
344 << "" << pathName
345 << " points outside your accessible address space."
346 << exit(FatalError);
347
348 return false;
349 }
350
351 case EACCES:
352 {
353 FatalErrorInFunction
354 << "The parent directory does not allow write "

Callers 15

cpFunction · 0.70
mainFunction · 0.50
mainFunction · 0.50
writeFunction · 0.50
mainFunction · 0.50
mergeAndWriteFunction · 0.50
doCommandFunction · 0.50
mainFunction · 0.50
mainFunction · 0.50
mainFunction · 0.50
createFields.HFile · 0.50
collapse.HFile · 0.50

Calls 5

printStackFunction · 0.70
exitFunction · 0.50
emptyMethod · 0.45
sizeMethod · 0.45
pathMethod · 0.45

Tested by 2

mainFunction · 0.40
mainFunction · 0.40