MCPcopy Create free account
hub / github.com/MapServer/MapServer / msOGRCleanupDS

Function msOGRCleanupDS

mapogroutput.c:165–206  ·  view source on GitHub ↗

/ msOGRCleanupDS() */ /

Source from the content-addressed store, hash-verified

163/* msOGRCleanupDS() */
164/************************************************************************/
165static void msOGRCleanupDS( const char *datasource_name )
166
167{
168 char **file_list;
169 char path[MS_MAXPATHLEN];
170 int i;
171
172 strlcpy( path, CPLGetPath( datasource_name ), sizeof(path) );
173 file_list = CPLReadDir( path );
174
175 for( i = 0; file_list != NULL && file_list[i] != NULL; i++ )
176 {
177 char full_filename[MS_MAXPATHLEN];
178 VSIStatBufL sStatBuf;
179
180 if( EQUAL(file_list[i],".") || EQUAL(file_list[i],"..") )
181 continue;
182
183 strlcpy( full_filename,
184 CPLFormFilename( path, file_list[i], NULL ),
185 sizeof(full_filename) );
186
187 VSIStatL( full_filename, &sStatBuf );
188
189 if( VSI_ISREG( sStatBuf.st_mode ) )
190 {
191 VSIUnlink( full_filename );
192 }
193 else if( VSI_ISDIR( sStatBuf.st_mode ) )
194 {
195 char fake_ds_name[MS_MAXPATHLEN];
196 strlcpy( fake_ds_name,
197 CPLFormFilename( full_filename, "abc.dat", NULL ),
198 sizeof(fake_ds_name) );
199 msOGRCleanupDS( fake_ds_name );
200 }
201 }
202
203 CSLDestroy( file_list );
204
205 VSIRmdir( path );
206}
207
208/************************************************************************/
209/* msOGRWriteShape() */

Callers 1

msOGRWriteFromQueryFunction · 0.85

Calls 1

strlcpyFunction · 0.85

Tested by

no test coverage detected