MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / CreateDirectory

Method CreateDirectory

Source/Engine/Platform/Unix/UnixFileSystem.cpp:30–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28const DateTime UnixEpoch(1970, 1, 1);
29
30bool UnixFileSystem::CreateDirectory(const StringView& path)
31{
32 const UnixString pathAnsi(*path, path.Length());
33
34 // Skip if already exists
35 struct stat fileInfo;
36 if (stat(pathAnsi.Get(), &fileInfo) != -1 && S_ISDIR(fileInfo.st_mode))
37 {
38 return false;
39 }
40
41 // Recursively do it all again for the parent directory, if any
42 const int32 slashIndex = path.FindLast('/');
43 if (slashIndex > 1)
44 {
45 if (CreateDirectory(path.Substring(0, slashIndex)))
46 {
47 return true;
48 }
49 }
50
51 // Create the last directory on the path (the recursive calls will have taken care of the parent directories by now)
52 return mkdir(pathAnsi.Get(), 0755) != 0 && errno != EEXIST;
53}
54
55#if HAS_DIRS
56

Callers 15

DirectoryCopyMethod · 0.45
MoveMethod · 0.45
CopyMethod · 0.45
CreateModuleMethod · 0.45
OnInitMethod · 0.45
ImportMethod · 0.45
ImportMethod · 0.45
InitializeMethod · 0.45
NewFolderMethod · 0.45

Calls 5

SubstringMethod · 0.80
statClass · 0.70
LengthMethod · 0.45
GetMethod · 0.45
FindLastMethod · 0.45

Tested by

no test coverage detected