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

Method CreateDirectory

Source/Engine/Platform/Android/AndroidFileSystem.cpp:113–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113bool AndroidFileSystem::CreateDirectory(const StringView& path)
114{
115 const StringAsANSI<> pathAnsi(*path, path.Length());
116
117 // Skip if already exists
118 struct stat fileInfo;
119 if (stat(pathAnsi.Get(), &fileInfo) != -1 && S_ISDIR(fileInfo.st_mode))
120 {
121 return false;
122 }
123
124 // Recursively do it all again for the parent directory, if any
125 const int32 slashIndex = path.FindLast('/');
126 if (slashIndex > 1)
127 {
128 if (CreateDirectory(path.Substring(0, slashIndex)))
129 {
130 return true;
131 }
132 }
133
134 // Create the last directory on the path (the recursive calls will have taken care of the parent directories by now)
135 return mkdir(pathAnsi.Get(), 0755) != 0 && errno != EEXIST;
136}
137
138bool AndroidFileSystem::DeleteDirectory(const String& path, bool deleteContents)
139{

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected