mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-12-24 10:32:32 +00:00
Merge pull request #163 from atmaxinger/fix-devpollcdrom
Mac GUI: don't show /dev/poll/cdrom if it is configured as cdrom
This commit is contained in:
commit
2e302d60a3
@ -120,11 +120,14 @@ static NSString *getStringFromPrefs(const char *key)
|
|||||||
/* Fetch all CDROMs */
|
/* Fetch all CDROMs */
|
||||||
index = 0;
|
index = 0;
|
||||||
while ((dsk = PrefsFindString("cdrom", index++)) != NULL) {
|
while ((dsk = PrefsFindString("cdrom", index++)) != NULL) {
|
||||||
DiskType *disk = [[[DiskType alloc] init] autorelease];
|
NSString *path = [NSString stringWithUTF8String: dsk ];
|
||||||
[disk setPath:[NSString stringWithUTF8String: dsk ]];
|
if (![path hasPrefix:@"/dev/"]) {
|
||||||
[disk setIsCDROM:YES];
|
DiskType *disk = [[[DiskType alloc] init] autorelease];
|
||||||
|
[disk setPath:[NSString stringWithUTF8String: dsk ]];
|
||||||
|
[disk setIsCDROM:YES];
|
||||||
|
|
||||||
[diskArray addObject:disk];
|
[diskArray addObject:disk];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[disks setDataSource: self];
|
[disks setDataSource: self];
|
||||||
@ -403,10 +406,19 @@ static NSString *makeRelativeIfNecessary(NSString *path)
|
|||||||
// Remove all disks
|
// Remove all disks
|
||||||
while (PrefsFindString("disk"))
|
while (PrefsFindString("disk"))
|
||||||
PrefsRemoveItem("disk");
|
PrefsRemoveItem("disk");
|
||||||
// Remove all cdroms
|
// Remove all cdroms (but keep the ones in /dev/)
|
||||||
while (PrefsFindString("cdrom"))
|
const char *path;
|
||||||
PrefsRemoveItem("cdrom");
|
int index = 0;
|
||||||
|
while ((path = PrefsFindString("cdrom", index)) != NULL) {
|
||||||
|
NSString *p = [NSString stringWithUTF8String: path];
|
||||||
|
if (![p hasPrefix:@"/dev/"]) {
|
||||||
|
PrefsRemoveItem("cdrom", index);
|
||||||
|
} else {
|
||||||
|
// only increase the index if the current entry has not been deleted
|
||||||
|
// if it has been deleted, the next entry is on the current entrys index
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Write all disks
|
// Write all disks
|
||||||
for (int i = 0; i < [diskArray count]; i++) {
|
for (int i = 0; i < [diskArray count]; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user