Ignore:
Timestamp:
Sep 30, 2018 9:40:43 AM (23 months ago)
Author:
meeh <meeh@…>
Branches:
master
Children:
b5497ef
Parents:
36b758f
Message:

Mac OSX Launcher:

  • Update readme about event manager
  • RouterTask? can now detect a running router by scanning processes&arguments for i2p.jar
  • The logger will log to OSX's default: ~/Library/Logs?/I2P/[whatever].log
File:
1 edited

Legend:

Unmodified
Added
Removed
  • launchers/macosx/main.mm

    r36b758f r2233f7f  
    3333#include "include/strutil.hpp"
    3434
     35#include "Logger.h"
     36#include "LoggerWorker.hpp"
     37
    3538using namespace subprocess;
    36 
    3739#endif
    3840
    3941#define debug(format, ...) CFShow([NSString stringWithFormat:format, ## __VA_ARGS__]);
     42
     43
    4044
    4145@interface AppDelegate () <NSUserNotificationCenterDelegate, NSApplicationDelegate>
     
    6973  std::string basePath(homeDir);
    7074  basePath.append("/Library/I2P");
     75 
    7176  auto jarResPath = [launcherBundle pathForResource:@"launcher" ofType:@"jar"];
    7277  NSLog(@"Trying to load launcher.jar from url = %@", jarResPath);
     
    196201
    197202  NSBundle *launcherBundle = [NSBundle mainBundle];
     203 
    198204 
    199205  // Helper object to hold statefull path information
     
    289295@end
    290296
    291 
     297#ifdef __cplusplus
     298namespace {
     299  const std::string logDirectory = getDefaultLogDir();
     300}
     301#endif
    292302
    293303int main(int argc, const char **argv)
     
    295305  NSApplication *app = [NSApplication sharedApplication];
    296306
     307#ifdef __cplusplus
     308  mkdir(logDirectory.c_str(), S_IRUSR | S_IWUSR | S_IXUSR);
     309 
     310  SharedLogWorker logger("I2PLauncher", logDirectory);
     311  MeehLog::initializeLogging(&logger);
     312 
     313  MLOG(INFO) << "Application is starting up";
     314#endif
     315 
    297316  AppDelegate *appDelegate = [[AppDelegate alloc] initWithArgc:argc argv:argv];
    298317  app.delegate = appDelegate;
     
    305324    [NSApp terminate:nil];
    306325  }
     326#pragma GCC diagnostic push
     327#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
    307328  [NSBundle loadNibNamed:@"I2Launcher" owner:NSApp];
    308 
     329#pragma GCC diagnostic pop
     330 
    309331  [NSApp run];
    310332  return 0;
Note: See TracChangeset for help on using the changeset viewer.