MCPcopy Create free account
hub / github.com/davisking/dlib / create_directory

Function create_directory

dlib/misc_api/misc_api_kernel_1.cpp:117–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115// ----------------------------------------------------------------------------------------
116
117 void create_directory (
118 const std::string& dir
119 )
120 {
121 if (CreateDirectoryA(dir.c_str(),0) == 0)
122 {
123 // an error has occurred
124 if (GetLastError() == ERROR_ALREADY_EXISTS)
125 {
126 // make sure this is actually a directory
127 DWORD attribs = GetFileAttributesA(dir.c_str());
128 if (attribs == INVALID_FILE_ATTRIBUTES ||
129 (attribs&FILE_ATTRIBUTE_DIRECTORY) == 0)
130 {
131 // it isn't a directory
132 throw dir_create_error(dir);
133 }
134 }
135 else
136 {
137 throw dir_create_error(dir);
138 }
139 }
140 }
141
142// ----------------------------------------------------------------------------------------
143

Callers

nothing calls this directly

Calls 1

dir_create_errorClass · 0.70

Tested by

no test coverage detected