10.6 compatibility: Fix some new compiler warnings, and work around apparent regressions in NSTask and -stringByStandardizingPath.
2 // UniqueWindowController.m
5 // Created by Jens Alfke on 3/14/08.
6 // Copyright 2008 Jens Alfke. All rights reserved.
9 #import "UniqueWindowController.h"
10 #import "GraphicsUtils.h"
13 @implementation UniqueWindowController
16 + (BOOL) isModel: (id)model1 equalToModel: (id)model2
18 return model1==model2;
22 + (UniqueWindowController*) instanceWith: (id)model
24 for( NSWindow *window in OpenWindowsWithDelegateClass(self) ) {
25 UniqueWindowController *c = window.delegate;
26 if( [self isModel: c.model equalToModel: model] )
33 + (UniqueWindowController*) openWith: (id)model
35 UniqueWindowController *w = [self instanceWith: model];
37 w = [[self alloc] initWith: model];
40 if( model != w.model )
41 [w reopenWith: model];
43 [w.window makeKeyAndOrderFront: self];
48 - (void) reopenWith: (id)model
53 - (void) windowWillClose: (NSNotification*)n
63 Copyright (c) 2008, Jens Alfke <jens@mooseyard.com>. All rights reserved.
65 Redistribution and use in source and binary forms, with or without modification, are permitted
66 provided that the following conditions are met:
68 * Redistributions of source code must retain the above copyright notice, this list of conditions
69 and the following disclaimer.
70 * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
71 and the following disclaimer in the documentation and/or other materials provided with the
74 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
75 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
76 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRI-
77 BUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
78 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
79 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
80 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
81 THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.