mirror of
https://github.com/mauiaaron/apple2.git
synced 2024-12-27 06:29:19 +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) {
|
||||
char *disk = NULL;
|
||||
int err = 0;
|
||||
#ifdef __APPLE__
|
||||
char **path = NULL;
|
||||
|
||||
#if defined(__APPLE__)
|
||||
CFBundleRef mainBundle = CFBundleGetMainBundle();
|
||||
CFStringRef fileString = CFStringCreateWithCString(/*allocator*/NULL, fileName, CFStringGetSystemEncoding());
|
||||
CFURLRef fileURL = CFBundleCopyResourceURL(mainBundle, fileString, NULL, NULL);
|
||||
@ -144,15 +145,48 @@ int test_setup_boot_disk(const char *fileName, int readonly) {
|
||||
FREE(disk);
|
||||
}
|
||||
CFRELEASE(filePath);
|
||||
|
||||
char *paths[] = {
|
||||
disk,
|
||||
NULL,
|
||||
};
|
||||
#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
|
||||
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);
|
||||
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;
|
||||
}
|
||||
}
|
||||
FREE(disk);
|
||||
|
||||
path = &paths[0];
|
||||
while (*path) {
|
||||
char *disk = *path;
|
||||
++path;
|
||||
FREE(disk);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user