]> git.saurik.com Git - wxWidgets.git/blob - src/mac/filedlg.cpp
Avoid double free in wxComboBox::SetClientObject.
[wxWidgets.git] / src / mac / filedlg.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: filedlg.cpp
3 // Purpose: wxFileDialog
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 1998-01-01
7 // RCS-ID: $Id$
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation "filedlg.h"
14 #endif
15
16 #include "wx/defs.h"
17 #include "wx/app.h"
18 #include "wx/utils.h"
19 #include "wx/dialog.h"
20 #include "wx/filedlg.h"
21 #include "wx/intl.h"
22 #include "wx/tokenzr.h"
23
24 #ifndef __DARWIN__
25 #include "PLStringFuncs.h"
26 #endif
27
28 #if !USE_SHARED_LIBRARY
29 IMPLEMENT_CLASS(wxFileDialog, wxFileDialogBase)
30 #endif
31
32 // begin wxmac
33
34 #include "wx/mac/private.h"
35
36 #include <Navigation.h>
37
38 #ifdef __DARWIN__
39 # include "MoreFilesX.h"
40 #else
41 # include "MoreFiles.h"
42 # include "MoreFilesExtras.h"
43 #endif
44
45 extern bool gUseNavServices ;
46
47 // the data we need to pass to our standard file hook routine
48 // includes a pointer to the dialog, a pointer to the standard
49 // file reply record (so we can inspect the current selection)
50 // and a copy of the "previous" file spec of the reply record
51 // so we can see if the selection has changed
52
53 struct OpenUserDataRec {
54 int currentfilter ;
55 bool saveMode ;
56 wxArrayString name ;
57 wxArrayString extensions ;
58 wxArrayLong filtermactypes ;
59 wxString defaultLocation;
60 #if TARGET_CARBON
61 CFArrayRef menuitems ;
62 #else
63 NavMenuItemSpecArrayHandle menuitems ;
64 #endif
65 };
66
67 typedef struct OpenUserDataRec
68 OpenUserDataRec, *OpenUserDataRecPtr;
69
70 static pascal void NavEventProc(
71 NavEventCallbackMessage inSelector,
72 NavCBRecPtr ioParams,
73 NavCallBackUserData ioUserData);
74
75 #if TARGET_CARBON
76 static NavEventUPP sStandardNavEventFilter = NewNavEventUPP(NavEventProc);
77 #else
78 static NavEventUPP sStandardNavEventFilter = NewNavEventProc(NavEventProc);
79 #endif
80
81 static pascal void
82 NavEventProc(
83 NavEventCallbackMessage inSelector,
84 NavCBRecPtr ioParams,
85 NavCallBackUserData ioUserData )
86 {
87 OpenUserDataRec * data = ( OpenUserDataRec *) ioUserData ;
88 if (inSelector == kNavCBEvent) {
89 #if TARGET_CARBON
90 #else
91 wxTheApp->MacHandleOneEvent(ioParams->eventData.eventDataParms.event);
92 #endif
93 }
94 else if ( inSelector == kNavCBStart )
95 {
96 #if TARGET_CARBON
97 if (data && !(data->defaultLocation).IsEmpty())
98 {
99 // Set default location for the modern Navigation APIs
100 // Apple Technical Q&A 1151
101 FSSpec theFSSpec;
102 wxMacFilename2FSSpec(data->defaultLocation, &theFSSpec);
103 AEDesc theLocation = {typeNull, NULL};
104 if (noErr == ::AECreateDesc(typeFSS, &theFSSpec, sizeof(FSSpec), &theLocation))
105 ::NavCustomControl(ioParams->context, kNavCtlSetLocation, (void *) &theLocation);
106 }
107 #else
108 if ( data->menuitems )
109 NavCustomControl(ioParams->context, kNavCtlSelectCustomType, &(*data->menuitems)[data->currentfilter]);
110 #endif
111 }
112 else if ( inSelector == kNavCBPopupMenuSelect )
113 {
114 NavMenuItemSpec * menu = (NavMenuItemSpec *) ioParams->eventData.eventDataParms.param ;
115 #if TARGET_CARBON
116 #else
117 if ( menu->menuCreator == 'WXNG' )
118 #endif
119 {
120 data->currentfilter = menu->menuType ;
121 if ( data->saveMode )
122 {
123 int i = menu->menuType ;
124 wxString extension = data->extensions[i].AfterLast('.') ;
125 extension.MakeLower() ;
126 wxString sfilename ;
127
128 #if TARGET_CARBON
129 wxMacCFStringHolder cfString( NavDialogGetSaveFileName( ioParams->context ) , false );
130 sfilename = cfString.AsString() ;
131 #else
132 Str255 filename ;
133 // get the current filename
134 NavCustomControl(ioParams->context, kNavCtlGetEditFileName, &filename);
135 sfilename = wxMacMakeStringFromPascal( filename ) ;
136 #endif
137
138 int pos = sfilename.Find('.',TRUE) ;
139 if ( pos != wxNOT_FOUND )
140 {
141 sfilename = sfilename.Left(pos+1)+extension ;
142 #if TARGET_CARBON
143 cfString = sfilename ;
144 NavDialogSetSaveFileName( ioParams->context , cfString ) ;
145 #else
146 wxMacStringToPascal( sfilename , filename ) ;
147 NavCustomControl(ioParams->context, kNavCtlSetEditFileName, &filename);
148 #endif
149 }
150 }
151 }
152 }
153 }
154
155 const wxChar * gfilters[] =
156 {
157 wxT("*.TXT") ,
158 wxT("*.TIF") ,
159 wxT("*.JPG") ,
160
161 NULL
162 } ;
163
164 OSType gfiltersmac[] =
165 {
166 'TEXT' ,
167 'TIFF' ,
168 'JPEG' ,
169
170 '****'
171 } ;
172
173
174 void MakeUserDataRec(OpenUserDataRec *myData , const wxString& filter )
175 {
176 myData->menuitems = NULL ;
177 myData->currentfilter = 0 ;
178 myData->saveMode = FALSE ;
179
180 if ( filter && filter[0] )
181 {
182 wxString filter2(filter) ;
183 int filterIndex = 0;
184 bool isName = true ;
185 wxString current ;
186 for( unsigned int i = 0; i < filter2.Len() ; i++ )
187 {
188 if( filter2.GetChar(i) == wxT('|') )
189 {
190 if( isName ) {
191 myData->name.Add( current ) ;
192 }
193 else {
194 myData->extensions.Add( current.MakeUpper() ) ;
195 ++filterIndex ;
196 }
197 isName = !isName ;
198 current = wxEmptyString ;
199 }
200 else
201 {
202 current += filter2.GetChar(i) ;
203 }
204 }
205 // we allow for compatibility reason to have a single filter expression (like *.*) without
206 // an explanatory text, in that case the first part is name and extension at the same time
207
208 wxASSERT_MSG( filterIndex == 0 || !isName , wxT("incorrect format of format string") ) ;
209 if ( current.IsEmpty() )
210 myData->extensions.Add( myData->name[filterIndex] ) ;
211 else
212 myData->extensions.Add( current.MakeUpper() ) ;
213 if ( filterIndex == 0 || isName )
214 myData->name.Add( current.MakeUpper() ) ;
215
216 ++filterIndex ;
217
218 const size_t extCount = myData->extensions.GetCount();
219 for ( size_t i = 0 ; i < extCount; i++ )
220 {
221 int j ;
222 for ( j = 0 ; gfilters[j] ; j++ )
223 {
224 if ( myData->extensions[i] == gfilters[j] )
225 {
226 myData->filtermactypes.Add( gfiltersmac[j] ) ;
227 break ;
228 }
229 }
230 if( gfilters[j] == NULL )
231 {
232 myData->filtermactypes.Add( '****' ) ;
233 }
234 }
235 }
236 }
237
238 static Boolean CheckFile( const wxString &filename , OSType type , OpenUserDataRecPtr data)
239 {
240 wxString file(filename) ;
241 file.MakeUpper() ;
242
243 if ( data->extensions.GetCount() > 0 )
244 {
245 //for ( int i = 0 ; i < data->numfilters ; ++i )
246 int i = data->currentfilter ;
247 if ( data->extensions[i].Right(2) == wxT(".*") )
248 return true ;
249
250 {
251 if ( type == (OSType)data->filtermactypes[i] )
252 return true ;
253
254 wxStringTokenizer tokenizer( data->extensions[i] , wxT(";") ) ;
255 while( tokenizer.HasMoreTokens() )
256 {
257 wxString extension = tokenizer.GetNextToken() ;
258 if ( extension.GetChar(0) == '*' )
259 extension = extension.Mid(1) ;
260
261 if ( file.Len() >= extension.Len() && extension == file.Right(extension.Len() ) )
262 return true ;
263 }
264 }
265 return false ;
266 }
267 return true ;
268 }
269
270 #ifndef __DARWIN__
271 static pascal Boolean CrossPlatformFileFilter(CInfoPBPtr myCInfoPBPtr, void *dataPtr)
272 {
273 OpenUserDataRecPtr data = (OpenUserDataRecPtr) dataPtr ;
274 // return true if this item is invisible or a file
275
276 Boolean visibleFlag;
277 Boolean folderFlag;
278
279 visibleFlag = ! (myCInfoPBPtr->hFileInfo.ioFlFndrInfo.fdFlags & kIsInvisible);
280 folderFlag = (myCInfoPBPtr->hFileInfo.ioFlAttrib & 0x10);
281
282 // because the semantics of the filter proc are "true means don't show
283 // it" we need to invert the result that we return
284
285 if ( !visibleFlag )
286 return true ;
287
288 if ( !folderFlag )
289 {
290 wxString file = wxMacMakeStringFromPascal( myCInfoPBPtr->hFileInfo.ioNamePtr ) ;
291 return !CheckFile( file , myCInfoPBPtr->hFileInfo.ioFlFndrInfo.fdType , data ) ;
292 }
293
294 return false ;
295 }
296 #endif
297
298 // end wxmac
299
300 wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
301 const wxString& defaultDir, const wxString& defaultFileName, const wxString& wildCard,
302 long style, const wxPoint& pos)
303 :wxFileDialogBase(parent, message, defaultDir, defaultFileName, wildCard, style, pos)
304 {
305 wxASSERT_MSG( NavServicesAvailable() , wxT("Navigation Services are not running") ) ;
306 }
307
308 pascal Boolean CrossPlatformFilterCallback (
309 AEDesc *theItem,
310 void *info,
311 void *callBackUD,
312 NavFilterModes filterMode
313 )
314 {
315 bool display = true;
316 OpenUserDataRecPtr data = (OpenUserDataRecPtr) callBackUD ;
317
318 if (filterMode == kNavFilteringBrowserList)
319 {
320 NavFileOrFolderInfo* theInfo = (NavFileOrFolderInfo*) info ;
321 if ( !theInfo->isFolder )
322 {
323 if (theItem->descriptorType == typeFSS )
324 {
325 FSSpec spec;
326 memcpy( &spec , *theItem->dataHandle , sizeof(FSSpec) ) ;
327 wxString file = wxMacMakeStringFromPascal( spec.name ) ;
328 display = CheckFile( file , theInfo->fileAndFolder.fileInfo.finderInfo.fdType , data ) ;
329 }
330 #if TARGET_CARBON
331 else if ( theItem->descriptorType == typeFSRef )
332 {
333 FSRef fsref ;
334 memcpy( &fsref , *theItem->dataHandle , sizeof(FSRef) ) ;
335 wxString file ;
336 const short maxpath = 1024 ;
337 FSRefMakePath( &fsref , (UInt8*) file.GetWriteBuf(maxpath+1),maxpath) ;
338 file.UngetWriteBuf() ;
339 display = CheckFile( file , theInfo->fileAndFolder.fileInfo.finderInfo.fdType , data ) ;
340 }
341 #endif
342 }
343 }
344
345 return display;
346 }
347
348 int wxFileDialog::ShowModal()
349 {
350 #if TARGET_CARBON
351 OSErr err;
352 NavDialogCreationOptions dialogCreateOptions;
353 // set default options
354 ::NavGetDefaultDialogCreationOptions(&dialogCreateOptions);
355
356 // this was always unset in the old code
357 dialogCreateOptions.optionFlags &= ~kNavSelectDefaultLocation;
358
359 #if wxUSE_UNICODE
360 // tried using wxMacCFStringHolder in the code below, but it seems
361 // the CFStrings were being released before the save dialog was called,
362 // causing a crash - open dialog works fine with or without wxMacCFStringHolder
363 CFStringRef titleRef = ::CFStringCreateWithCString(NULL,
364 m_message.wc_str(),
365 kCFStringEncodingUnicode);
366 #else
367 CFStringRef titleRef = ::CFStringCreateWithCString(NULL,
368 m_message.c_str(),
369 CFStringGetSystemEncoding());
370 #endif
371 dialogCreateOptions.windowTitle = titleRef;
372 #if wxUSE_UNICODE
373 CFStringRef defaultFileNameRef = ::CFStringCreateWithCString(NULL,
374 m_fileName.wc_str(),
375 kCFStringEncodingUnicode);
376 #else
377 CFStringRef defaultFileNameRef = ::CFStringCreateWithCString(NULL,
378 m_fileName.c_str(),
379 CFStringGetSystemEncoding());
380 #endif
381 dialogCreateOptions.saveFileName = defaultFileNameRef;
382 NavDialogRef dialog;
383 NavObjectFilterUPP navFilterUPP = NULL;
384 CFArrayRef cfArray = NULL; // for popupExtension
385 OpenUserDataRec myData;
386 myData.defaultLocation = m_dir;
387
388 if (m_dialogStyle & wxSAVE)
389 {
390 dialogCreateOptions.optionFlags |= kNavNoTypePopup;
391 dialogCreateOptions.optionFlags |= kNavDontAutoTranslate;
392 dialogCreateOptions.optionFlags |= kNavDontAddTranslateItems;
393
394 // The extension is important
395 dialogCreateOptions.optionFlags |= kNavPreserveSaveFileExtension;
396
397
398 err = ::NavCreatePutFileDialog(&dialogCreateOptions,
399 'TEXT',
400 'TEXT',
401 sStandardNavEventFilter,
402 &myData, // for defaultLocation
403 &dialog);
404 }
405 else
406 {
407 MakeUserDataRec(&myData , m_wildCard);
408 int numfilters = myData.extensions.GetCount();
409 if (numfilters > 0){
410 CFMutableArrayRef popup = CFArrayCreateMutable( kCFAllocatorDefault ,
411 numfilters , &kCFTypeArrayCallBacks ) ;
412 dialogCreateOptions.popupExtension = popup ;
413 myData.menuitems = dialogCreateOptions.popupExtension ;
414 for ( size_t i = 0 ; i < numfilters ; ++i )
415 {
416 CFArrayAppendValue( popup , (CFStringRef) wxMacCFStringHolder( myData.name[i] ) ) ;
417 }
418 }
419 navFilterUPP = NewNavObjectFilterUPP(CrossPlatformFilterCallback);
420 err = ::NavCreateGetFileDialog(&dialogCreateOptions,
421 NULL, // NavTypeListHandle
422 sStandardNavEventFilter,
423 NULL, // NavPreviewUPP
424 navFilterUPP,
425 (void *) &myData, // inClientData
426 &dialog);
427 }
428
429 if (err == noErr)
430 err = ::NavDialogRun(dialog);
431
432 // clean up filter related data, etc.
433 if (navFilterUPP)
434 ::DisposeNavObjectFilterUPP(navFilterUPP);
435 if (cfArray)
436 {
437 CFIndex n = ::CFArrayGetCount(cfArray);
438 for (CFIndex i = 0; i < n; i++)
439 {
440 CFStringRef str = (CFStringRef) ::CFArrayGetValueAtIndex(cfArray, i);
441 if (str)
442 ::CFRelease(str);
443 }
444 ::CFRelease(cfArray);
445 }
446 if (titleRef)
447 ::CFRelease(titleRef);
448 if (defaultFileNameRef)
449 ::CFRelease(defaultFileNameRef);
450 if (err != noErr)
451 return wxID_CANCEL;
452
453 NavReplyRecord navReply;
454 err = ::NavDialogGetReply(dialog, &navReply);
455 if (err == noErr && navReply.validRecord)
456 {
457 AEKeyword theKeyword;
458 DescType actualType;
459 Size actualSize;
460 FSRef theFSRef;
461 char thePath[FILENAME_MAX];
462
463 long count;
464 ::AECountItems(&navReply.selection , &count);
465 for (long i = 1; i <= count; ++i)
466 {
467 err = ::AEGetNthPtr(&(navReply.selection), 1, typeFSRef, &theKeyword, &actualType,
468 &theFSRef, sizeof(theFSRef), &actualSize);
469 if (err != noErr)
470 break;
471
472 if (m_dialogStyle & wxSAVE)
473 {
474 thePath[0] = '\0';
475 CFURLRef parentURLRef = ::CFURLCreateFromFSRef(NULL, &theFSRef);
476
477 if (parentURLRef)
478 {
479 CFURLRef fullURLRef =
480 ::CFURLCreateCopyAppendingPathComponent(NULL,
481 parentURLRef,
482 navReply.saveFileName,
483 false);
484 ::CFRelease(parentURLRef);
485 if (fullURLRef)
486 {
487 CFStringRef cfString = ::CFURLCopyPath(fullURLRef);
488 ::CFRelease(fullURLRef);
489
490 if (cfString)
491 {
492 // unescape the URL for
493 // "file name" instead of "file%20name"
494 CFStringRef cfStringUnescaped =
495 ::CFURLCreateStringByReplacingPercentEscapes(NULL,
496 cfString,
497 CFSTR(""));
498 ::CFRelease(cfString);
499
500 if (cfStringUnescaped)
501 {
502 #if wxUSE_UNICODE
503 ::CFStringGetCString(cfStringUnescaped,
504 thePath,
505 FILENAME_MAX,
506 kCFStringEncodingUnicode);
507 #else
508 ::CFStringGetCString(cfStringUnescaped,
509 thePath,
510 FILENAME_MAX,
511 CFStringGetSystemEncoding());
512 #endif
513 ::CFRelease(cfStringUnescaped);
514 }
515 }
516 }
517 }
518 if (!thePath[0])
519 {
520 ::NavDisposeReply(&navReply);
521 return wxID_CANCEL;
522 }
523 }
524 else
525 {
526 err = ::FSRefMakePath(&theFSRef,
527 (UInt8 *)thePath, sizeof(thePath));
528 if (err != noErr)
529 break;
530 }
531 m_path = thePath;
532 m_paths.Add(m_path);
533 m_fileName = wxFileNameFromPath(m_path);
534 m_fileNames.Add(m_fileName);
535 }
536 // set these to the first hit
537 m_path = m_paths[0];
538 m_fileName = wxFileNameFromPath(m_path);
539 m_dir = wxPathOnly(m_path);
540 }
541 ::NavDisposeReply(&navReply);
542
543 return (err == noErr) ? wxID_OK : wxID_CANCEL;
544 #else // TARGET_CARBON
545
546 NavDialogOptions mNavOptions;
547 NavObjectFilterUPP mNavFilterUPP = NULL;
548 NavPreviewUPP mNavPreviewUPP = NULL ;
549 NavReplyRecord mNavReply;
550 AEDesc mDefaultLocation ;
551 bool mSelectDefault = false ;
552 OSStatus err = noErr ;
553 // setup dialog
554
555 mNavFilterUPP = nil;
556 mNavPreviewUPP = nil;
557 mSelectDefault = false;
558 mDefaultLocation.descriptorType = typeNull;
559 mDefaultLocation.dataHandle = nil;
560
561 NavGetDefaultDialogOptions(&mNavOptions);
562 wxMacStringToPascal( m_message , (StringPtr)mNavOptions.message ) ;
563 wxMacStringToPascal( m_fileName , (StringPtr)mNavOptions.savedFileName ) ;
564
565 // Set default location, the location
566 // that's displayed when the dialog
567 // first appears
568
569 FSSpec location ;
570 wxMacFilename2FSSpec( m_dir , &location ) ;
571
572 err = ::AECreateDesc(typeFSS, &location, sizeof(FSSpec), &mDefaultLocation );
573
574 if ( mDefaultLocation.dataHandle ) {
575
576 if (mSelectDefault) {
577 mNavOptions.dialogOptionFlags |= kNavSelectDefaultLocation;
578 } else {
579 mNavOptions.dialogOptionFlags &= ~kNavSelectDefaultLocation;
580 }
581 }
582
583 memset( &mNavReply , 0 , sizeof( mNavReply ) ) ;
584 mNavReply.validRecord = false;
585 mNavReply.replacing = false;
586 mNavReply.isStationery = false;
587 mNavReply.translationNeeded = false;
588 mNavReply.selection.descriptorType = typeNull;
589 mNavReply.selection.dataHandle = nil;
590 mNavReply.keyScript = smSystemScript;
591 mNavReply.fileTranslation = nil;
592 mNavReply.version = kNavReplyRecordVersion ;
593
594 // zero all data
595
596 m_path = wxEmptyString ;
597 m_fileName = wxEmptyString ;
598 m_paths.Empty();
599 m_fileNames.Empty();
600
601 OpenUserDataRec myData;
602 MakeUserDataRec( &myData , m_wildCard ) ;
603 myData.currentfilter = m_filterIndex ;
604 if ( myData.extensions.GetCount() > 0 )
605 {
606 mNavOptions.popupExtension = (NavMenuItemSpecArrayHandle) NewHandle( sizeof( NavMenuItemSpec ) * myData.extensions.GetCount() ) ;
607 myData.menuitems = mNavOptions.popupExtension ;
608 for ( size_t i = 0 ; i < myData.extensions.GetCount() ; ++i )
609 {
610 (*mNavOptions.popupExtension)[i].version = kNavMenuItemSpecVersion ;
611 (*mNavOptions.popupExtension)[i].menuCreator = 'WXNG' ;
612 // TODO : according to the new docs -1 to 10 are reserved for the OS
613 (*mNavOptions.popupExtension)[i].menuType = i ;
614 wxMacStringToPascal( myData.name[i] , (StringPtr)(*mNavOptions.popupExtension)[i].menuItemName ) ;
615 }
616 }
617 if ( m_dialogStyle & wxSAVE )
618 {
619 myData.saveMode = true ;
620
621 mNavOptions.dialogOptionFlags |= kNavDontAutoTranslate ;
622 mNavOptions.dialogOptionFlags |= kNavDontAddTranslateItems ;
623
624 err = ::NavPutFile(
625 &mDefaultLocation,
626 &mNavReply,
627 &mNavOptions,
628 sStandardNavEventFilter ,
629 NULL,
630 kNavGenericSignature,
631 &myData); // User Data
632 m_filterIndex = myData.currentfilter ;
633 }
634 else
635 {
636 myData.saveMode = false ;
637
638 mNavFilterUPP = NewNavObjectFilterUPP( CrossPlatformFilterCallback ) ;
639 if ( m_dialogStyle & wxMULTIPLE )
640 mNavOptions.dialogOptionFlags |= kNavAllowMultipleFiles ;
641 else
642 mNavOptions.dialogOptionFlags &= ~kNavAllowMultipleFiles ;
643
644 err = ::NavGetFile(
645 &mDefaultLocation,
646 &mNavReply,
647 &mNavOptions,
648 sStandardNavEventFilter ,
649 mNavPreviewUPP,
650 mNavFilterUPP,
651 NULL ,
652 &myData);
653 m_filterIndex = myData.currentfilter ;
654 }
655
656 DisposeNavObjectFilterUPP(mNavFilterUPP);
657 if ( mDefaultLocation.dataHandle != nil )
658 {
659 ::AEDisposeDesc(&mDefaultLocation);
660 }
661
662 if ( (err != noErr) && (err != userCanceledErr) ) {
663 return wxID_CANCEL ;
664 }
665
666 if (mNavReply.validRecord) {
667
668 FSSpec outFileSpec ;
669 AEDesc specDesc ;
670 AEKeyword keyWord ;
671
672 long count ;
673 ::AECountItems( &mNavReply.selection , &count ) ;
674 for ( long i = 1 ; i <= count ; ++i )
675 {
676 OSErr err = ::AEGetNthDesc( &mNavReply.selection , i , typeFSS, &keyWord , &specDesc);
677 if ( err != noErr ) {
678 m_path = wxT("") ;
679 return wxID_CANCEL ;
680 }
681 outFileSpec = **(FSSpec**) specDesc.dataHandle;
682 if (specDesc.dataHandle != nil) {
683 ::AEDisposeDesc(&specDesc);
684 }
685 m_path = wxMacFSSpec2MacFilename( &outFileSpec ) ;
686
687 m_paths.Add( m_path ) ;
688 m_fileName = wxFileNameFromPath(m_path);
689 m_fileNames.Add(m_fileName);
690 }
691 // set these to the first hit
692 m_path = m_paths[ 0 ] ;
693 m_fileName = wxFileNameFromPath(m_path);
694 m_dir = wxPathOnly(m_path);
695 NavDisposeReply( &mNavReply ) ;
696 return wxID_OK ;
697 }
698 return wxID_CANCEL;
699 #endif // TARGET_CARBON
700 }
701