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

Function create_directory

dlib/misc_api/misc_api_kernel_2.cpp:88–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86// ----------------------------------------------------------------------------------------
87
88 void create_directory (
89 const std::string& dir
90 )
91 {
92 if (mkdir(dir.c_str(),0777))
93 {
94 // an error has occurred
95 if (errno == EEXIST)
96 {
97 struct stat buffer;
98 // now check that this is actually a valid directory
99 if (::stat(dir.c_str(),&buffer))
100 {
101 // the directory was not found
102 throw dir_create_error(dir);
103 }
104 else if (S_ISDIR(buffer.st_mode) == 0)
105 {
106 // It is not a directory
107 throw dir_create_error(dir);
108 }
109 }
110 else
111 {
112 throw dir_create_error(dir);
113 }
114 }
115 }
116
117// ----------------------------------------------------------------------------------------
118}

Callers 2

mainFunction · 0.50
add_filesFunction · 0.50

Calls 2

statClass · 0.85
dir_create_errorClass · 0.70

Tested by

no test coverage detected