Hi...

If one wants to run a tool and +[NSBundle mainBundle] is called it will run into serious trouble...

Imagine you have a tool which fullpath is
/imagine/your/favourite/path/tool

+[NSBundle mainBundle] first generates
toolName = tool
path = /imagine/your/favourite/path

Afterwards it checks path for having a .app/.debug etc suffix. When this suffix is not present (look above) the tool is declared to be a non-application (isApplication = NO). And now the bug happens.

   if (isApplication == NO)
   {
     path = [path stringByAppendingPathComponent: @"Resources"];
     path = [path stringByAppendingPathComponent: toolName];
    }

So path is now: /imagine/your/favourite/path/Resources/tool which is then used for [_mainBundle initWithPath:path] which fails.... So if you have a standalone tool, do you really need this directory-structure for it??? It looks a bit odd to me....

To get my tools working I commented out the if() shown above and everything is fine now for me...
The attached patch does this as well....


Roland

--- NSBundle.m.orig     2003-07-21 14:19:47.000000000 +0200
+++ NSBundle.m  2003-07-21 14:20:00.000000000 +0200
@@ -830,12 +830,12 @@
              isApplication = NO;
            }
        }
-      
+      /*
       if (isApplication == NO)
        {
          path = [path stringByAppendingPathComponent: @"Resources"];
          path = [path stringByAppendingPathComponent: toolName];
-       }
+       }*/
 
       NSDebugMLLog(@"NSBundle", @"Found main in [EMAIL PROTECTED]", path);
       /* We do alloc and init separately so initWithPath: knows we are
_______________________________________________
Bug-gnustep mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-gnustep

Reply via email to