tags:

views:

16

answers:

0

I managed to setup the the online help system for the main application help which is using the CFBundleHelpBookFolder and CFBundleHelpBookName from the bundle Info.plist.

But i can't display other help files. I use the following AHRegisterHelpBook code which gets called with the help bundle path like "/Users/llothar/Python.help". The error result code is -50.

static void register_book_bundle (char* str) 
{
  NSString* path = [[NSString alloc] initWithUTF8String: str];
  NSBundle* bundle = [NSBundle bundleWithPath: path];
  NSString *bundleIdent = [[bundle infoDictionary] objectForKey:@"CFBundleIdentifier"];
  CFBundleRef mainBundle = CFBundleGetBundleWithIdentifier((CFStringRef)bundleIdent);
  if (mainBundle) {
      CFURLRef bundleURL = NULL;
      CFRetain(mainBundle);
      bundleURL = CFBundleCopyBundleURL(mainBundle);
      if (bundleURL) {
          FSRef bundleFSRef;
          if (CFURLGetFSRef(bundleURL, &bundleFSRef)) {
              NSLog(@"register help book result %d\n",AHRegisterHelpBook(&bundleFSRef));
          }
          CFRelease(bundleURL);
      }
      CFRelease(mainBundle);
  }
  [path release];     
}

EDIT: Thanks to Code by Kevin i decided to skip the Help Viewer and do my own stuff. The floating panel style of the help book is really a serious negative point if you don't have simple applications. Maybe some day Apple finds a few dollars somewhere to rewrite the whole help system in Cocoa and with modern features (like bookmarks?).