mirror of
https://github.com/trudnai/Steve2.git
synced 2025-01-18 02:31:44 +00:00
More reliable way to determine if disk image has a .po file extension
This commit is contained in:
parent
bd764cf909
commit
8e6617bcee
@ -65,15 +65,9 @@ int dsk2woz( const char * filename ) {
|
|||||||
fclose(dsk_file);
|
fclose(dsk_file);
|
||||||
|
|
||||||
// Determine from the filename whether to use Pro-DOS sector order.
|
// Determine from the filename whether to use Pro-DOS sector order.
|
||||||
bool has_p = false;
|
const char *extension = filename + strlen(filename) - 3;
|
||||||
bool has_dot = false;
|
// for some reason macos does not have stricmp, so we do it in a not-so-efficient way
|
||||||
const char *extension = filename + strlen(filename);
|
const bool is_prodos = (strcmp(extension, ".po") == 0) || (strcmp(extension, ".PO") == 0);
|
||||||
do {
|
|
||||||
has_p = *extension == 'p';
|
|
||||||
has_dot = *extension == '.';
|
|
||||||
--extension;
|
|
||||||
} while(extension > filename && *extension != '/' && *extension != '.');
|
|
||||||
const bool is_prodos = has_p && has_dot;
|
|
||||||
|
|
||||||
// If the DSK image was too short, announce failure. Some DSK files
|
// If the DSK image was too short, announce failure. Some DSK files
|
||||||
// seem empirically to be too long, but it's unclear that the extra
|
// seem empirically to be too long, but it's unclear that the extra
|
||||||
|
Loading…
x
Reference in New Issue
Block a user