From ffb2e0153556f7dc9775b7462ba56687bb35caaa Mon Sep 17 00:00:00 2001 From: nigel <> Date: Tue, 9 Aug 2005 03:28:53 +0000 Subject: [PATCH] Started including 10.4 compile fixed from Kirk Kerekes, Confirmation on disk image Delete requested by Markus Gail. --- BasiliskII/src/MacOSX/PrefsEditor.mm | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/BasiliskII/src/MacOSX/PrefsEditor.mm b/BasiliskII/src/MacOSX/PrefsEditor.mm index 40db3824..57c20eee 100644 --- a/BasiliskII/src/MacOSX/PrefsEditor.mm +++ b/BasiliskII/src/MacOSX/PrefsEditor.mm @@ -105,8 +105,6 @@ @end -@implementation PrefsEditor - #import // For [NSBundle pathForImageResource:] proto #include @@ -116,12 +114,16 @@ extern string UserPrefsPath; // from prefs_unix.cpp #import "sysdeps.h" // Types used in Basilisk C++ code #import "video_macosx.h" // some items that we edit here #import "misc_macosx.h" // WarningSheet() prototype +#import "main_macosx.h" // ChoiceAlert() prototype + #import #define DEBUG 0 #import +@implementation PrefsEditor + - (PrefsEditor *) init { self = [super init]; @@ -259,7 +261,7 @@ extern string UserPrefsPath; // from prefs_unix.cpp - (IBAction) ChangeBootFrom: (NSMatrix *)sender { - if ( [sender selectedCell] == bootFromCD ) + if ( [sender selectedCell] == (id)bootFromCD ) PrefsReplaceInt32("bootdriver", CDROMRefNum); else PrefsReplaceInt32("bootdriver", 0); @@ -439,6 +441,7 @@ extern string UserPrefsPath; // from prefs_unix.cpp size = [newVolumeSize intValue]; sprintf(cmd, "dd if=/dev/zero \"of=%s\" bs=1024k count=%d", filename, size); + retVal = system(cmd); if (retVal != 0) { @@ -473,6 +476,9 @@ shouldProceedAfterError: (NSDictionary *) errorDict { NSString *Path = [self RemoveVolumeEntry]; + if ( ! Path ) + return; + if ( ! [[NSFileManager defaultManager] removeFileAtPath: Path handler: self] ) { @@ -582,7 +588,6 @@ shouldProceedAfterError: (NSDictionary *) errorDict PrefsRemoveItem(pref, 1); } -//- (const char *) RemoveVolumeEntry - (NSString *) RemoveVolumeEntry { int row = [diskImages selectedRow]; @@ -594,6 +599,13 @@ shouldProceedAfterError: (NSDictionary *) errorDict *str; int tmp = 0; + NSString *prompt = [NSString stringWithFormat: @"%s\n%s", + "Are you sure you want to delete the file", + path]; + + if ( ! ChoiceAlert([prompt cString], "Delete", "Cancel") ) + return NULL; + while ( (str = PrefsFindString("disk", tmp) ) != NULL ) { if ( strcmp(str, path) == 0 )