bug-gnustep
[Top][All Lists]
Advanced

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

NSBundle _bundle_name_first_match(NSString* directory, NSString* name BU


From: Francis
Subject: NSBundle _bundle_name_first_match(NSString* directory, NSString* name BUG ? rel 1.9.2 / 1.10.0
Date: Tue, 05 Oct 2004 23:03:14 +0200

Hi,

I've got problem with GXSMLParser with dtd loading :

<!DOCTYPE scene PUBLIC "-//AAV//DTD scene//FR" "scene.dtd">

It doesn't wotk. If I replace "scene.dtd" by "scene" and rename this
file in the Resources/DTDs directory it works.


I think that the problem is in NSBundle _bundle_name_first_match method.
It compares a file name with or without an extension against a file
without extension. I think thart we have first to remove the extension 
of the 'cleanname' ?

Thanks for your reply/help
Francis.

 

NSBundle.m

/* Find the first directory entry with a given name (with any extension)
*/
static NSString *
_bundle_name_first_match(NSString* directory, NSString* name)
{
  NSFileManager *mgr = [NSFileManager defaultManager];
  NSEnumerator  *filelist;
  NSString      *path;
  NSString      *match;
  NSString      *cleanname;

  /* name might have a directory in it also, so account for this */
  path = [[directory stringByAppendingPathComponent: name] 
    stringByDeletingLastPathComponent];

##################### my modification HERE
  cleanname = [[name lastPathComponent]stringByDeletingPathExtension];
#####################

  filelist = [[mgr directoryContentsAtPath: path] objectEnumerator];
  while ((match = [filelist nextObject]))
    {
      if ([cleanname isEqual: [match stringByDeletingPathExtension]])
        return [path stringByAppendingPathComponent: match];
    }

  return nil;
}






reply via email to

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