forked from I2P_Developers/i2p.i2p
Mac OSX Launcher: Moved Objective-C & C++ files to a better location.
This commit is contained in:
@@ -18,9 +18,10 @@
|
||||
|
||||
#include "RouterTask.h"
|
||||
|
||||
#include "version.h"
|
||||
// TODO: Configure the project to avoid such includes.
|
||||
#include "../version.h"
|
||||
|
||||
@class SwiftMainDelegate;
|
||||
@class SwiftApplicationDelegate;
|
||||
@class I2PDeployer;
|
||||
|
||||
@protocol SwiftMainDelegateProto
|
||||
@@ -90,7 +91,7 @@ inline void sendUserNotification(NSString* title, NSString* informativeText, boo
|
||||
@interface AppDelegate : NSObject <NSUserNotificationCenterDelegate, NSApplicationDelegate>
|
||||
@property BOOL enableLogging;
|
||||
@property BOOL enableVerboseLogging;
|
||||
@property (assign) SwiftMainDelegate *swiftRuntime;
|
||||
@property (assign) SwiftApplicationDelegate *swiftRuntime;
|
||||
@property (assign) NSUserDefaults *userPreferences;
|
||||
@property (assign) ExtractMetaInfo *metaInfo;
|
||||
@property (assign) I2PDeployer *deployer;
|
@@ -28,14 +28,16 @@
|
||||
#import "I2PLauncher-Swift.h"
|
||||
|
||||
#include "AppDelegate.h"
|
||||
#include "include/fn.h"
|
||||
// TODO: Configure the project to avoid such includes.
|
||||
#include "../include/fn.h"
|
||||
#include "../include/subprocess.hpp"
|
||||
#include "../include/strutil.hpp"
|
||||
|
||||
#import "SBridge.h"
|
||||
#include "logger_c.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "include/subprocess.hpp"
|
||||
#include "include/strutil.hpp"
|
||||
|
||||
#include "Logger.h"
|
||||
#include "LoggerWorker.hpp"
|
@@ -20,7 +20,8 @@
|
||||
#include <condition_variable>
|
||||
#include <functional>
|
||||
|
||||
#include "include/sharedqueue.h"
|
||||
// TODO: Configure the project to avoid such includes.
|
||||
#include "../include/sharedqueue.h"
|
||||
#include "Logger.h"
|
||||
|
||||
struct SharedLogWorkerImpl;
|
@@ -5,7 +5,10 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include "include/subprocess.hpp"
|
||||
// TODO: Configure the project to avoid such includes.
|
||||
#include "../include/subprocess.hpp"
|
||||
#include "../include/PidWatcher.h"
|
||||
|
||||
#import "I2PLauncher-Swift.h"
|
||||
#include "AppDelegate.h"
|
||||
|
||||
@@ -15,7 +18,6 @@
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
#include "include/PidWatcher.h"
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
#import <Foundation/Foundation.h>
|
@@ -17,7 +17,8 @@
|
||||
#include <glob.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "include/fn.h"
|
||||
// TODO: Configure the project to avoid such includes.
|
||||
#include "../include/fn.h"
|
||||
|
||||
namespace osx {
|
||||
inline void openUrl(NSString* url)
|
@@ -25,7 +25,8 @@
|
||||
#include "logger_c.h"
|
||||
|
||||
#include "AppDelegate.h"
|
||||
#include "include/fn.h"
|
||||
// TODO: Configure the project to avoid such includes.
|
||||
#include "../include/fn.h"
|
||||
|
||||
|
||||
@implementation SBridge
|
88
launchers/macosx/I2PLauncher/ObjectiveC/logger_c.h
Normal file
88
launchers/macosx/I2PLauncher/ObjectiveC/logger_c.h
Normal file
@@ -0,0 +1,88 @@
|
||||
//
|
||||
// logger_c.h
|
||||
// I2PLauncher
|
||||
//
|
||||
// Created by Mikal Villa on 30/09/2018.
|
||||
// Copyright © 2018 The I2P Project. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef logger_c_h
|
||||
#define logger_c_h
|
||||
|
||||
#include "Logger.h"
|
||||
#include "LoggerWorker.hpp"
|
||||
|
||||
/*
|
||||
void genericLogger(int loglevel, va_list params) {
|
||||
#ifdef __cplusplus
|
||||
const char * paramArray[10];
|
||||
int numParams = 0;
|
||||
|
||||
NSString* arg = nil;
|
||||
while ((arg = va_arg(params, NSString *))) {
|
||||
paramArray[numParams++] = [arg cStringUsingEncoding:[NSString defaultCStringEncoding]];
|
||||
}
|
||||
|
||||
switch (loglevel) {
|
||||
case 0:
|
||||
MLOGF(ANNOYING) << params;
|
||||
break;
|
||||
case 1:
|
||||
MLOGF(DEBUG) << params;
|
||||
break;
|
||||
case 2:
|
||||
MLOGF(INFO) << params;
|
||||
break;
|
||||
case 3:
|
||||
MLOGF(WARN) << params;
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
*/
|
||||
|
||||
inline void MLog(int loglevel, NSString* format, ...)
|
||||
{
|
||||
#ifdef __cplusplus
|
||||
|
||||
va_list vargs;
|
||||
va_start(vargs, format);
|
||||
NSString* formattedMessage = [[NSString alloc] initWithFormat:format arguments:vargs];
|
||||
va_end(vargs);
|
||||
|
||||
NSString* message = formattedMessage;
|
||||
|
||||
switch (loglevel) {
|
||||
case 0:
|
||||
MLOG(ANNOYING) << [message UTF8String];
|
||||
break;
|
||||
case 1:
|
||||
MLOG(DEBUG) << [message UTF8String];
|
||||
break;
|
||||
case 2:
|
||||
MLOG(INFO) << [message UTF8String];
|
||||
break;
|
||||
case 3:
|
||||
MLOG(WARN) << [message UTF8String];
|
||||
break;
|
||||
case 4:
|
||||
MLOG(ERROR) << [message UTF8String];
|
||||
break;
|
||||
default:
|
||||
#if DEBUG
|
||||
assert(false);
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define MMLog(format_string,...) ((MLog(1, [NSString stringWithFormat:format_string,##__VA_ARGS__])))
|
||||
|
||||
#endif /* logger_c_h */
|
Reference in New Issue
Block a user