- data->tracks[count].fname = strdup(current_file);
- if (data->tracks[count].fname == NULL) break;
-
- tmpf = fopen(current_file, "rb");
- if (tmpf == NULL) {
- elprintf(EL_STATUS, "cue: bad/missing file: \"%s\"", current_file);
- count--; break;
+ if (file_openable(current_file))
+ goto file_ok;
+
+ elprintf(EL_STATUS, "cue: bad/missing file: \"%s\"", current_file);
+ if (count == 1) {
+ int cue_ucase;
+ char v;
+
+ get_ext(current_file, ext, NULL, 0);
+ snprintf(current_filep, current_filep_size,
+ "%s%s", cue_base, ext);
+ if (file_openable(current_file))
+ goto file_ok;
+
+ // try with the same case (for unix)
+ v = fname[fname_len - 1];
+ cue_ucase = ('A' <= v && v <= 'Z');
+ change_case(ext, cue_ucase);
+
+ snprintf(current_filep, current_filep_size,
+ "%s%s", cue_base, ext);
+ if (file_openable(current_file))
+ goto file_ok;