discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Annoying excpetion


From: Nicola Pero
Subject: Re: Annoying excpetion
Date: Mon, 4 Jun 2001 15:11:58 +0100 (BST)

> > > "Couldn't find encoding type for selector 
> > > initWithDirectoryPath:recurseIntoSubdirectories:followSymlinks:prefixFiles:"
> > 
> > That one was a private API internal to the gnustep-base library.
> > This API now has changed (I rewrote the file manager internals to be
> > faster).
> > 
> > The new gnustep-gui does not use this private internal API any longer, but
> > the old one did (and it shouldn't have), so changing the internal API
> > in gnustep-base broke it.
> 
> But I am using
> 
>     openPanel = [NSOpenPanel openPanel];
>     retval = [openPanel runModalForDirectory:directory file:nil types:types];
> 
> which is a valid method. I do not use any internal API in my code directly. 
> So what should I use in order to make it work?

Your code is fine :-)

It is the gnustep-gui library which you are using which is internally
using a private API of the gnustep-base library which is no longer
available.  A more recent gnustep-gui uses the public API and so is immune
from this problem.

Replacing gnustep-gui and gnustep-xgps with a daily snapshot and
reconfiguring, recompiling and reinstalling them should be fine (you can
keep all the rest of the system, so it shouldn't be so difficult!)

Otherwise, you might try applying the following patch to your
gui/Source/NSSavePanel.m, and recompile gnustep-gui with this:

==================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSSavePanel.m,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- gnustep/gnustep/core/gui/Source/NSSavePanel.m       2001/03/22 00:27:37     
1.42
+++ gnustep/gnustep/core/gui/Source/NSSavePanel.m       2001/04/06 22:41:55     
1.43
@@ -969,7 +969,7 @@
 createRowsForColumn: (int)column
        inMatrix: (NSMatrix*)matrix
 {
-  NSString              *path, *pathTmp, *file, *pathAndFile, *extension, *h; 
+  NSString              *path, *file, *pathAndFile, *extension, *h; 
   NSArray               *files, *hiddenFiles;
   unsigned              i, count, addedRows; 
   BOOL                  exists, isDir;
@@ -981,25 +981,11 @@
   NSString              *progressString = nil;
   /* We create lot of objects in this method, so we use a pool */
   NSAutoreleasePool     *pool;
-  NSDirectoryEnumerator *dirEnum;
-  IMP                   nxtImp;
-  IMP                   addImp;
 
   pool = [NSAutoreleasePool new];
   
   path = [_browser pathToColumn: column];
-  dirEnum = AUTORELEASE([[NSDirectoryEnumerator alloc]
-                         initWithDirectoryPath: path 
-                         recurseIntoSubdirectories: NO
-                         followSymlinks: NO
-                         prefixFiles: NO]);
-  files = [NSMutableArray arrayWithCapacity: 16];
-
-  nxtImp = [dirEnum methodForSelector: @selector(nextObject)];
-  addImp = [files   methodForSelector: @selector(addObject:)];
-
-  while ((pathTmp = (*nxtImp)(dirEnum, @selector(nextObject))) != nil)
-    (*addImp)(files, @selector(addObject:), pathTmp);
+  files = [[NSFileManager defaultManager] directoryContentsAtPath: path];
 
   // Remove hidden files
   h = [path stringByAppendingPathComponent: @".hidden"];




reply via email to

[Prev in Thread] Current Thread [Next in Thread]