- SFSaveDisk = 0x214, CurDirStore = 0x398
- };
- FSSpec cwdSpec ;
-
- FSMakeFSSpec( - *(short *) SFSaveDisk , *(long *) CurDirStore , NULL , &cwdSpec ) ;
- wxString res = wxMacFSSpec2UnixFilename( &cwdSpec ) ;
- strcpy( buf , res ) ;
- if (0) {
-#else
- if (getcwd(cbuf, sz) == NULL) {
-#endif
- delete [] cbuf;
-#else // wxUnicode
-#ifdef _MSC_VER
- if (_getcwd(buf, sz) == NULL) {
-#elif defined(__WXMAC__) && !defined(__UNIX__)
- FSSpec cwdSpec ;
- FCBPBRec pb;
- OSErr error;
- Str255 fileName ;
- pb.ioNamePtr = (StringPtr) &fileName;
- pb.ioVRefNum = 0;
- pb.ioRefNum = LMGetCurApRefNum();
- pb.ioFCBIndx = 0;
- error = PBGetFCBInfoSync(&pb);
- if ( error == noErr )
- {
- cwdSpec.vRefNum = pb.ioFCBVRefNum;
- cwdSpec.parID = pb.ioFCBParID;
- cwdSpec.name[0] = 0 ;
- wxString res = wxMacFSSpec2MacFilename( &cwdSpec ) ;
-
- strcpy( buf , res ) ;
- buf[res.length()-1]=0 ;
- }
- else
- buf[0] = 0 ;
- /*
- this version will not always give back the application directory on mac
- enum
- {
- SFSaveDisk = 0x214, CurDirStore = 0x398
- };
- FSSpec cwdSpec ;
-
- FSMakeFSSpec( - *(short *) SFSaveDisk , *(long *) CurDirStore , NULL , &cwdSpec ) ;
- wxString res = wxMacFSSpec2UnixFilename( &cwdSpec ) ;
- strcpy( buf , res ) ;
- */
- if (0) {
-#elif(__VISAGECPP__)
- APIRET rc;
- rc = ::DosQueryCurrentDir( 0 // current drive
- ,buf
- ,(PULONG)&sz
- );
- if (rc != 0) {
-#else
- if (getcwd(buf, sz) == NULL) {
-#endif
-#endif
- buf[0] = wxT('.');
- buf[1] = wxT('\0');
- }
-#if wxUSE_UNICODE
- else {
- wxConvFile.MB2WC(buf, cbuf, sz);
- delete [] cbuf;
- }
+ pos = filters[i].Find(wxT(';'));
+ if (pos != wxNOT_FOUND)
+ {
+ // first split only filters
+ descriptions.Insert(descriptions[i],i+1);
+ filters.Insert(filters[i].Mid(pos+1),i+1);
+ filters[i]=filters[i].Left(pos);
+
+ // autoreplace new filter in description with pattern:
+ // C/C++ Files(*.cpp;*.c;*.h)|*.cpp;*.c;*.h
+ // cause split into:
+ // C/C++ Files(*.cpp)|*.cpp
+ // C/C++ Files(*.c;*.h)|*.c;*.h
+ // and next iteration cause another split into:
+ // C/C++ Files(*.cpp)|*.cpp
+ // C/C++ Files(*.c)|*.c
+ // C/C++ Files(*.h)|*.h
+ for ( size_t k=i;k<i+2;k++ )
+ {
+ pos = descriptions[k].Find(filters[k]);
+ if (pos != wxNOT_FOUND)
+ {
+ wxString before = descriptions[k].Left(pos);
+ wxString after = descriptions[k].Mid(pos+filters[k].Len());
+ pos = before.Find(wxT('('),true);
+ if (pos>before.Find(wxT(')'),true))
+ {
+ before = before.Left(pos+1);
+ before << filters[k];
+ pos = after.Find(wxT(')'));
+ int pos1 = after.Find(wxT('('));
+ if (pos != wxNOT_FOUND && (pos<pos1 || pos1==wxNOT_FOUND))
+ {
+ before << after.Mid(pos);
+ descriptions[k] = before;
+ }
+ }
+ }
+ }
+ }
+ }