mirror of
https://github.com/mauiaaron/apple2.git
synced 2025-01-15 09:30:16 +00:00
Check more paths in attempt to satisfy test suite disk insertion
- This is mainly to accommodate disk locations on Android
This commit is contained in:
parent
2c8284d41f
commit
3a20c96296
@ -128,9 +128,10 @@ void test_common_init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int test_setup_boot_disk(const char *fileName, int readonly) {
|
int test_setup_boot_disk(const char *fileName, int readonly) {
|
||||||
char *disk = NULL;
|
|
||||||
int err = 0;
|
int err = 0;
|
||||||
#ifdef __APPLE__
|
char **path = NULL;
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
CFBundleRef mainBundle = CFBundleGetMainBundle();
|
CFBundleRef mainBundle = CFBundleGetMainBundle();
|
||||||
CFStringRef fileString = CFStringCreateWithCString(/*allocator*/NULL, fileName, CFStringGetSystemEncoding());
|
CFStringRef fileString = CFStringCreateWithCString(/*allocator*/NULL, fileName, CFStringGetSystemEncoding());
|
||||||
CFURLRef fileURL = CFBundleCopyResourceURL(mainBundle, fileString, NULL, NULL);
|
CFURLRef fileURL = CFBundleCopyResourceURL(mainBundle, fileString, NULL, NULL);
|
||||||
@ -144,15 +145,48 @@ int test_setup_boot_disk(const char *fileName, int readonly) {
|
|||||||
FREE(disk);
|
FREE(disk);
|
||||||
}
|
}
|
||||||
CFRELEASE(filePath);
|
CFRELEASE(filePath);
|
||||||
|
|
||||||
|
char *paths[] = {
|
||||||
|
disk,
|
||||||
|
NULL,
|
||||||
|
};
|
||||||
#else
|
#else
|
||||||
asprintf(&disk, "%s/disks/%s", data_dir, fileName);
|
char *paths[] = {
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
};
|
||||||
|
asprintf(&paths[0], "%s/disks/%s", data_dir, fileName);
|
||||||
|
asprintf(&paths[1], "%s/disks/demo/%s", data_dir, fileName);
|
||||||
|
asprintf(&paths[2], "%s/disks/blanks/%s", data_dir, fileName);
|
||||||
#endif
|
#endif
|
||||||
if (disk6_insert(0, disk, readonly)) {
|
|
||||||
|
path = &paths[0];
|
||||||
|
while (*path) {
|
||||||
|
char *disk = *path;
|
||||||
|
++path;
|
||||||
|
|
||||||
|
err = disk6_insert(0, disk, readonly) != NULL;
|
||||||
|
if (!err) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
int len = strlen(disk);
|
int len = strlen(disk);
|
||||||
disk[len-3] = '\0'; // try again without '.gz' extension
|
disk[len-3] = '\0'; // try again without '.gz' extension
|
||||||
err = (disk6_insert(0, disk, readonly) != NULL);
|
err = disk6_insert(0, disk, readonly) != NULL;
|
||||||
|
if (!err) {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
path = &paths[0];
|
||||||
|
while (*path) {
|
||||||
|
char *disk = *path;
|
||||||
|
++path;
|
||||||
FREE(disk);
|
FREE(disk);
|
||||||
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user