From: Andrew M. <fit...@us...> - 2006-08-31 04:26:46
|
Update of /cvsroot/radmind/radmind-assistant/rte In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv7762 Modified Files: UMArrayController.m Log Message: Override super's remove: to delete filter from disk as well as array. Index: UMArrayController.m =================================================================== RCS file: /cvsroot/radmind/radmind-assistant/rte/UMArrayController.m,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** UMArrayController.m 29 Aug 2006 01:25:23 -0000 1.1 --- UMArrayController.m 31 Aug 2006 04:26:43 -0000 1.2 *************** *** 1,4 **** --- 1,6 ---- #import "UMArrayController.h" + #include <unistd.h> + @implementation UMArrayController *************** *** 99,101 **** --- 101,138 ---- } + - ( void )remove: ( id )sender + { + NSString *filterName; + NSString *filterPath; + id tmp, object; + + tmp = [ self selectedObjects ]; + object = [ tmp objectAtIndex: 0 ]; + + filterName = [ object objectForKey: @"filterName" ]; + + if ( floor( NSAppKitVersionNumber ) <= NSAppKitVersionNumber10_3 ) { + /* 10.3 doesn't have NSApplicationSupportDirectory defined */ + tmp = [ NSArray arrayWithObject: + [ @"~/Library/Application Support" stringByExpandingTildeInPath ]]; + } else { + tmp = NSSearchPathForDirectoriesInDomains( + NSApplicationSupportDirectory, NSUserDomainMask, YES ); + } + + filterPath = [ NSString stringWithFormat: + @"%@/Radmind Transcript Editor/Filters/" + @"%@.transcriptFilter", + [ tmp objectAtIndex: 0 ], filterName ]; + + if ( unlink( [ filterPath UTF8String ] ) != 0 ) { + if ( errno != ENOENT ) { + /* XXX NSError subclass here */ + NSLog( @"Couldn't remove %@", filterPath ); + } + } + + [ super remove: sender ]; + } + @end |