mirror of
https://github.com/pjreddie/darknet.git
synced 2023-08-10 21:13:14 +03:00
cleaner check for extension
This commit is contained in:

committed by
GitHub

parent
f73ace38fa
commit
328cce0bf5
11
src/utils.c
11
src/utils.c
@ -256,10 +256,13 @@ void replace_image_to_label(const char* input_path, char* output_path)
|
||||
find_replace_extension(output_path, ".TIFF", ".txt", output_path);
|
||||
|
||||
// Check file ends with txt:
|
||||
char output_path_ext[3];
|
||||
memcpy( output_path_ext, &output_path[strlen(output_path)-3], 3);
|
||||
if( strcmp("txt", output_path_ext) != 0){
|
||||
fprintf(stderr, "Failed to infer label file name (check image extension is supported): %s \n", output_path);
|
||||
if(strlen(output_path) > 4) {
|
||||
char *output_path_ext = output_path + strlen(output_path) - 4;
|
||||
if( strcmp(".txt", output_path_ext) != 0){
|
||||
fprintf(stderr, "Failed to infer label file name (check image extension is supported): %s \n", output_path);
|
||||
}
|
||||
}else{
|
||||
fprintf(stderr, "Label file name is too short: %s \n", output_path);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user