Ignore:
Timestamp:
Sep 20, 2018 3:20:39 AM (2 years ago)
Author:
meeh <meeh@…>
Branches:
master
Children:
85ebb2f
Parents:
3c0a8cf
Message:

Mac OS X Launcher: more cleanup and some bugfixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • launchers/macosx/SBridge.mm

    r3c0a8cf re8decff5  
    3434    options.i2pBaseDir = i2pBaseDir;
    3535    auto instance = [[I2PRouterTask alloc] initWithOptions: options];
    36     //setGlobalRouterObject(instance);
    37     //NSThread *thr = [[NSThread alloc] initWithTarget:instance selector:@selector(execute) object:nil];
    3836    [instance execute];
    3937    sendUserNotification(APP_IDSTR, @"The I2P router is starting up.");
     
    5452}
    5553
    56 namespace osx {
    57   inline void openUrl(NSString* url)
    58   {
    59     [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString: url]];
    60   }
    61 }
    62 
    63 inline std::vector<std::string> globVector(const std::string& pattern){
    64   glob_t glob_result;
    65   glob(pattern.c_str(),GLOB_TILDE,NULL,&glob_result);
    66   std::vector<std::string> files;
    67   for(unsigned int i=0;i<glob_result.gl_pathc;++i){
    68     files.push_back(std::string(glob_result.gl_pathv[i]));
    69   }
    70   globfree(&glob_result);
    71   return files;
    72 }
    73 
    74 inline std::string buildClassPathForObjC(std::string basePath)
    75 {
    76   NSBundle *launcherBundle = [NSBundle mainBundle];
    77   auto jarList = globVector(basePath+std::string("/lib/*.jar"));
    78  
    79   std::string classpathStrHead = "-classpath";
    80   std::string classpathStr = "";
    81   classpathStr += [[launcherBundle pathForResource:@"launcher" ofType:@"jar"] UTF8String];
    82   std::string prefix(basePath);
    83   prefix += "/lib/";
    84   for_each(jarList, [&classpathStr](std::string str){ classpathStr += std::string(":") + str; });
    85   return classpathStr;
    86 }
    8754
    8855
Note: See TracChangeset for help on using the changeset viewer.