I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit e046418f authored by meeh's avatar meeh
Browse files

Cleaning up the code base, remove dead code and failed attempts.

parent 802115e8
No related branches found
No related tags found
No related merge requests found
...@@ -5,6 +5,13 @@ ...@@ -5,6 +5,13 @@
#include <string.h> #include <string.h>
#include <memory.h> #include <memory.h>
#ifdef __cplusplus
#include <unistd.h>
#include <sys/types.h>
#include <pwd.h>
#include <assert.h>
#endif
#include <Cocoa/Cocoa.h> #include <Cocoa/Cocoa.h>
...@@ -35,8 +42,26 @@ ...@@ -35,8 +42,26 @@
@property (copy) NSString* zipFile; @property (copy) NSString* zipFile;
@property (copy) NSString* jarFile; @property (copy) NSString* jarFile;
@end @end
#ifdef __cplusplus #ifdef __cplusplus
#include "JavaHelper.h"
inline const char* RealHomeDirectory() {
struct passwd *pw = getpwuid(getuid());
assert(pw);
return pw->pw_dir;
}
inline std::string getDefaultBaseDir()
{
// Figure out base directory
auto homeDir = RealHomeDirectory();
const char* pathFromHome = "%s/Library/I2P";
char buffer[strlen(homeDir)+strlen(pathFromHome)];
sprintf(buffer, pathFromHome, homeDir);
std::string i2pBaseDir(buffer);
return i2pBaseDir;
}
inline void sendUserNotification(NSString* title, NSString* informativeText, NSImage* contentImage = NULL, bool makeSound = false) { inline void sendUserNotification(NSString* title, NSString* informativeText, NSImage* contentImage = NULL, bool makeSound = false) {
NSUserNotification *userNotification = [[NSUserNotification alloc] init]; NSUserNotification *userNotification = [[NSUserNotification alloc] init];
......
//
// Deployer.h
// I2PLauncher
//
// Created by Mikal Villa on 19/09/2018.
// Copyright © 2018 The I2P Project. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSObject ()
@end
//
// Deployer.m
// I2PLauncher
//
// Created by Mikal Villa on 19/09/2018.
// Copyright © 2018 The I2P Project. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "Deployer.h"
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
archiveVersion = 1; archiveVersion = 1;
classes = { classes = {
}; };
objectVersion = 50; objectVersion = 47;
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
BF1EFA41215141110014EB07 /* RouterTask.mm in Sources */ = {isa = PBXBuildFile; fileRef = BF1EFA3E215141100014EB07 /* RouterTask.mm */; }; BF1EFA41215141110014EB07 /* RouterTask.mm in Sources */ = {isa = PBXBuildFile; fileRef = BF1EFA3E215141100014EB07 /* RouterTask.mm */; };
BF1EFA47215141640014EB07 /* base.zip in Resources */ = {isa = PBXBuildFile; fileRef = BF1EFA44215141630014EB07 /* base.zip */; }; BF1EFA47215141640014EB07 /* base.zip in Resources */ = {isa = PBXBuildFile; fileRef = BF1EFA44215141630014EB07 /* base.zip */; };
BF1EFA48215141640014EB07 /* ItoopieTransparent.png in Resources */ = {isa = PBXBuildFile; fileRef = BF1EFA45215141640014EB07 /* ItoopieTransparent.png */; }; BF1EFA48215141640014EB07 /* ItoopieTransparent.png in Resources */ = {isa = PBXBuildFile; fileRef = BF1EFA45215141640014EB07 /* ItoopieTransparent.png */; };
BF1EFA4A215141CD0014EB07 /* NetworkExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF5061932113C6ED0014EB07 /* NetworkExtension.framework */; };
BF5061702113C48E0014EB07 /* I2PLauncher.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = BF50616E2113C48E0014EB07 /* I2PLauncher.xcdatamodeld */; }; BF5061702113C48E0014EB07 /* I2PLauncher.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = BF50616E2113C48E0014EB07 /* I2PLauncher.xcdatamodeld */; };
BF5061722113C4900014EB07 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BF5061712113C4900014EB07 /* Assets.xcassets */; }; BF5061722113C4900014EB07 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BF5061712113C4900014EB07 /* Assets.xcassets */; };
BF5061752113C4900014EB07 /* UserInterfaces.xib in Resources */ = {isa = PBXBuildFile; fileRef = BF5061732113C4900014EB07 /* UserInterfaces.xib */; }; BF5061752113C4900014EB07 /* UserInterfaces.xib in Resources */ = {isa = PBXBuildFile; fileRef = BF5061732113C4900014EB07 /* UserInterfaces.xib */; };
...@@ -25,7 +24,12 @@ ...@@ -25,7 +24,12 @@
BF53150D2150CE310014EB07 /* DateTimeUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF53150C2150CE310014EB07 /* DateTimeUtils.swift */; }; BF53150D2150CE310014EB07 /* DateTimeUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF53150C2150CE310014EB07 /* DateTimeUtils.swift */; };
BF5315132150EB510014EB07 /* RouterProcessStatus+ObjectiveC.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF5315122150EB510014EB07 /* RouterProcessStatus+ObjectiveC.swift */; }; BF5315132150EB510014EB07 /* RouterProcessStatus+ObjectiveC.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF5315122150EB510014EB07 /* RouterProcessStatus+ObjectiveC.swift */; };
BF531515215105B40014EB07 /* LogViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF531514215105B40014EB07 /* LogViewController.swift */; }; BF531515215105B40014EB07 /* LogViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF531514215105B40014EB07 /* LogViewController.swift */; };
BF650CA92152AC7D0014EB07 /* bumpInfoPlist.sh in Resources */ = {isa = PBXBuildFile; fileRef = BF650CA52152AC7D0014EB07 /* bumpInfoPlist.sh */; };
BF650CAA2152AC7D0014EB07 /* dmgconfig.py in Resources */ = {isa = PBXBuildFile; fileRef = BF650CA62152AC7D0014EB07 /* dmgconfig.py */; };
BF650CAB2152AC7D0014EB07 /* Deployer.m in Sources */ = {isa = PBXBuildFile; fileRef = BF650CA72152AC7D0014EB07 /* Deployer.m */; };
BF7506CB21509CFD0014EB07 /* RouterProcessStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF7506CA21509CFD0014EB07 /* RouterProcessStatus.swift */; }; BF7506CB21509CFD0014EB07 /* RouterProcessStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF7506CA21509CFD0014EB07 /* RouterProcessStatus.swift */; };
BF86541321515CA00014EB07 /* launcher.jar in Resources */ = {isa = PBXBuildFile; fileRef = BF1EFA46215141640014EB07 /* launcher.jar */; };
BF865417215182820014EB07 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF865416215182820014EB07 /* Foundation.framework */; };
BFBDCAE9215040670014EB07 /* Subprocess.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFBDCAE8215040670014EB07 /* Subprocess.swift */; }; BFBDCAE9215040670014EB07 /* Subprocess.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFBDCAE8215040670014EB07 /* Subprocess.swift */; };
BFBDCAEB215041630014EB07 /* TaskPipeline.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFBDCAEA215041630014EB07 /* TaskPipeline.swift */; }; BFBDCAEB215041630014EB07 /* TaskPipeline.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFBDCAEA215041630014EB07 /* TaskPipeline.swift */; };
BFBDCAED215041C10014EB07 /* Subprocess+CompactAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFBDCAEC215041C10014EB07 /* Subprocess+CompactAPI.swift */; }; BFBDCAED215041C10014EB07 /* Subprocess+CompactAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFBDCAEC215041C10014EB07 /* Subprocess+CompactAPI.swift */; };
...@@ -39,6 +43,7 @@ ...@@ -39,6 +43,7 @@
BFBDCB0021505BEE0014EB07 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BFBDCAFF21505BED0014EB07 /* AppKit.framework */; }; BFBDCB0021505BEE0014EB07 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BFBDCAFF21505BED0014EB07 /* AppKit.framework */; };
BFBDCB02215060190014EB07 /* DetectJava.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFBDCB01215060190014EB07 /* DetectJava.swift */; }; BFBDCB02215060190014EB07 /* DetectJava.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFBDCB01215060190014EB07 /* DetectJava.swift */; };
BFBDCB04215060970014EB07 /* StatusBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFBDCB03215060970014EB07 /* StatusBarController.swift */; }; BFBDCB04215060970014EB07 /* StatusBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFBDCB03215060970014EB07 /* StatusBarController.swift */; };
BFE1CBAD2151908F0014EB07 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BFE1CBAC2151908F0014EB07 /* CoreFoundation.framework */; };
BFF4581C213C48EA0014EB07 /* EventMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFF4581B213C48EA0014EB07 /* EventMonitor.swift */; }; BFF4581C213C48EA0014EB07 /* EventMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFF4581B213C48EA0014EB07 /* EventMonitor.swift */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
...@@ -62,7 +67,6 @@ ...@@ -62,7 +67,6 @@
BF5061742113C4900014EB07 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/UserInterfaces.xib; sourceTree = "<group>"; }; BF5061742113C4900014EB07 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/UserInterfaces.xib; sourceTree = "<group>"; };
BF5061762113C4900014EB07 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; BF5061762113C4900014EB07 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
BF5061792113C4900014EB07 /* I2PLauncher.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = I2PLauncher.entitlements; sourceTree = "<group>"; }; BF5061792113C4900014EB07 /* I2PLauncher.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = I2PLauncher.entitlements; sourceTree = "<group>"; };
BF5061932113C6ED0014EB07 /* NetworkExtension.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = NetworkExtension.framework; path = System/Library/Frameworks/NetworkExtension.framework; sourceTree = SDKROOT; };
BF5061952113C84E0014EB07 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; BF5061952113C84E0014EB07 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
BF5315062150C55B0014EB07 /* RouterRunner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RouterRunner.swift; sourceTree = "<group>"; }; BF5315062150C55B0014EB07 /* RouterRunner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RouterRunner.swift; sourceTree = "<group>"; };
BF5315082150C6760014EB07 /* RouterDeployer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RouterDeployer.swift; sourceTree = "<group>"; }; BF5315082150C6760014EB07 /* RouterDeployer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RouterDeployer.swift; sourceTree = "<group>"; };
...@@ -70,7 +74,13 @@ ...@@ -70,7 +74,13 @@
BF53150C2150CE310014EB07 /* DateTimeUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateTimeUtils.swift; sourceTree = "<group>"; }; BF53150C2150CE310014EB07 /* DateTimeUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateTimeUtils.swift; sourceTree = "<group>"; };
BF5315122150EB510014EB07 /* RouterProcessStatus+ObjectiveC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RouterProcessStatus+ObjectiveC.swift"; sourceTree = "<group>"; }; BF5315122150EB510014EB07 /* RouterProcessStatus+ObjectiveC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RouterProcessStatus+ObjectiveC.swift"; sourceTree = "<group>"; };
BF531514215105B40014EB07 /* LogViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogViewController.swift; sourceTree = "<group>"; }; BF531514215105B40014EB07 /* LogViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogViewController.swift; sourceTree = "<group>"; };
BF650CA52152AC7D0014EB07 /* bumpInfoPlist.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = bumpInfoPlist.sh; sourceTree = SOURCE_ROOT; };
BF650CA62152AC7D0014EB07 /* dmgconfig.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = dmgconfig.py; sourceTree = SOURCE_ROOT; };
BF650CA72152AC7D0014EB07 /* Deployer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Deployer.m; sourceTree = SOURCE_ROOT; };
BF650CA82152AC7D0014EB07 /* Deployer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Deployer.h; sourceTree = SOURCE_ROOT; };
BF7506CA21509CFD0014EB07 /* RouterProcessStatus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RouterProcessStatus.swift; sourceTree = "<group>"; }; BF7506CA21509CFD0014EB07 /* RouterProcessStatus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RouterProcessStatus.swift; sourceTree = "<group>"; };
BF865414215180F60014EB07 /* libswiftDarwin.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libswiftDarwin.tbd; path = System/Library/PrivateFrameworks/Swift/libswiftDarwin.tbd; sourceTree = SDKROOT; };
BF865416215182820014EB07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
BFBDCAE8215040670014EB07 /* Subprocess.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Subprocess.swift; sourceTree = "<group>"; }; BFBDCAE8215040670014EB07 /* Subprocess.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Subprocess.swift; sourceTree = "<group>"; };
BFBDCAEA215041630014EB07 /* TaskPipeline.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TaskPipeline.swift; sourceTree = "<group>"; }; BFBDCAEA215041630014EB07 /* TaskPipeline.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TaskPipeline.swift; sourceTree = "<group>"; };
BFBDCAEC215041C10014EB07 /* Subprocess+CompactAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Subprocess+CompactAPI.swift"; sourceTree = "<group>"; }; BFBDCAEC215041C10014EB07 /* Subprocess+CompactAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Subprocess+CompactAPI.swift"; sourceTree = "<group>"; };
...@@ -85,6 +95,7 @@ ...@@ -85,6 +95,7 @@
BFBDCAFF21505BED0014EB07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; BFBDCAFF21505BED0014EB07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
BFBDCB01215060190014EB07 /* DetectJava.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetectJava.swift; sourceTree = "<group>"; }; BFBDCB01215060190014EB07 /* DetectJava.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetectJava.swift; sourceTree = "<group>"; };
BFBDCB03215060970014EB07 /* StatusBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusBarController.swift; sourceTree = "<group>"; }; BFBDCB03215060970014EB07 /* StatusBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusBarController.swift; sourceTree = "<group>"; };
BFE1CBAC2151908F0014EB07 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
BFF45818213C428E0014EB07 /* I2PLauncher-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "I2PLauncher-Bridging-Header.h"; sourceTree = "<group>"; }; BFF45818213C428E0014EB07 /* I2PLauncher-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "I2PLauncher-Bridging-Header.h"; sourceTree = "<group>"; };
BFF4581B213C48EA0014EB07 /* EventMonitor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventMonitor.swift; sourceTree = "<group>"; }; BFF4581B213C48EA0014EB07 /* EventMonitor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventMonitor.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
...@@ -94,7 +105,8 @@ ...@@ -94,7 +105,8 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
BF1EFA4A215141CD0014EB07 /* NetworkExtension.framework in Frameworks */, BFE1CBAD2151908F0014EB07 /* CoreFoundation.framework in Frameworks */,
BF865417215182820014EB07 /* Foundation.framework in Frameworks */,
BFBDCB0021505BEE0014EB07 /* AppKit.framework in Frameworks */, BFBDCB0021505BEE0014EB07 /* AppKit.framework in Frameworks */,
BF5061962113C84E0014EB07 /* Cocoa.framework in Frameworks */, BF5061962113C84E0014EB07 /* Cocoa.framework in Frameworks */,
); );
...@@ -150,6 +162,10 @@ ...@@ -150,6 +162,10 @@
BF50616A2113C48E0014EB07 /* I2PLauncher */ = { BF50616A2113C48E0014EB07 /* I2PLauncher */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
BF650CA52152AC7D0014EB07 /* bumpInfoPlist.sh */,
BF650CA82152AC7D0014EB07 /* Deployer.h */,
BF650CA72152AC7D0014EB07 /* Deployer.m */,
BF650CA62152AC7D0014EB07 /* dmgconfig.py */,
BF1EFA42215141220014EB07 /* include */, BF1EFA42215141220014EB07 /* include */,
BF1EFA3F215141110014EB07 /* AppDelegate.h */, BF1EFA3F215141110014EB07 /* AppDelegate.h */,
BF1EFA3C215141100014EB07 /* JavaHelper.h */, BF1EFA3C215141100014EB07 /* JavaHelper.h */,
...@@ -177,9 +193,11 @@ ...@@ -177,9 +193,11 @@
BF5061922113C6ED0014EB07 /* Frameworks */ = { BF5061922113C6ED0014EB07 /* Frameworks */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
BFE1CBAC2151908F0014EB07 /* CoreFoundation.framework */,
BF865416215182820014EB07 /* Foundation.framework */,
BF865414215180F60014EB07 /* libswiftDarwin.tbd */,
BFBDCAFF21505BED0014EB07 /* AppKit.framework */, BFBDCAFF21505BED0014EB07 /* AppKit.framework */,
BF5061952113C84E0014EB07 /* Cocoa.framework */, BF5061952113C84E0014EB07 /* Cocoa.framework */,
BF5061932113C6ED0014EB07 /* NetworkExtension.framework */,
); );
name = Frameworks; name = Frameworks;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -236,15 +254,20 @@ ...@@ -236,15 +254,20 @@
BF5061602113C48E0014EB07 /* Project object */ = { BF5061602113C48E0014EB07 /* Project object */ = {
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastUpgradeCheck = 0940; LastUpgradeCheck = 1000;
ORGANIZATIONNAME = "The I2P Project"; ORGANIZATIONNAME = "The I2P Project";
TargetAttributes = { TargetAttributes = {
BF5061672113C48E0014EB07 = { BF5061672113C48E0014EB07 = {
CreatedOnToolsVersion = 9.4.1; CreatedOnToolsVersion = 9.4.1;
DevelopmentTeam = DTX4Q6WZN2;
LastSwiftMigration = 0940; LastSwiftMigration = 0940;
ProvisioningStyle = Automatic;
SystemCapabilities = { SystemCapabilities = {
com.apple.ApplicationGroups.Mac = {
enabled = 0;
};
com.apple.NetworkExtensions = { com.apple.NetworkExtensions = {
enabled = 1; enabled = 0;
}; };
com.apple.Sandbox = { com.apple.Sandbox = {
enabled = 0; enabled = 0;
...@@ -254,7 +277,7 @@ ...@@ -254,7 +277,7 @@
}; };
}; };
buildConfigurationList = BF5061632113C48E0014EB07 /* Build configuration list for PBXProject "I2PLauncher" */; buildConfigurationList = BF5061632113C48E0014EB07 /* Build configuration list for PBXProject "I2PLauncher" */;
compatibilityVersion = "Xcode 9.3"; compatibilityVersion = "Xcode 6.3";
developmentRegion = en; developmentRegion = en;
hasScannedForEncodings = 0; hasScannedForEncodings = 0;
knownRegions = ( knownRegions = (
...@@ -276,6 +299,9 @@ ...@@ -276,6 +299,9 @@
isa = PBXResourcesBuildPhase; isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
BF86541321515CA00014EB07 /* launcher.jar in Resources */,
BF650CAA2152AC7D0014EB07 /* dmgconfig.py in Resources */,
BF650CA92152AC7D0014EB07 /* bumpInfoPlist.sh in Resources */,
BF07789721506C810014EB07 /* Storyboard.storyboard in Resources */, BF07789721506C810014EB07 /* Storyboard.storyboard in Resources */,
BF5061722113C4900014EB07 /* Assets.xcassets in Resources */, BF5061722113C4900014EB07 /* Assets.xcassets in Resources */,
BF5061752113C4900014EB07 /* UserInterfaces.xib in Resources */, BF5061752113C4900014EB07 /* UserInterfaces.xib in Resources */,
...@@ -298,7 +324,7 @@ ...@@ -298,7 +324,7 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "# Run from launchers/macosx\nexport BUILDDIR=$(pwd)\ncd ../..\nant preppkg-osx\ncd pkg-temp\nrm -f ../base.zip\nzip -r7 ../base.zip *\ncp ../base.zip $BUILDDIR\ncd $BUILDDIR\n\n\n\n"; shellScript = "# Run from launchers/macosx\nexport BUILDDIR=$(pwd)\ncd ..\nsbt macosx:assembly\ncd ..\nant preppkg-osx\ncd pkg-temp\nrm -f ../base.zip\nzip -r -v -9 ../base.zip *\ncp ../base.zip $BUILDDIR/base.zip\ncd $BUILDDIR\ncp $BUILDDIR/target/scala-2.11/routerLauncher-assembly-0.1.0-SNAPSHOT.jar $BUILDDIR/launcher.jar\n\n\n\n";
}; };
/* End PBXShellScriptBuildPhase section */ /* End PBXShellScriptBuildPhase section */
...@@ -320,6 +346,7 @@ ...@@ -320,6 +346,7 @@
BFBDCAED215041C10014EB07 /* Subprocess+CompactAPI.swift in Sources */, BFBDCAED215041C10014EB07 /* Subprocess+CompactAPI.swift in Sources */,
BFBDCB02215060190014EB07 /* DetectJava.swift in Sources */, BFBDCB02215060190014EB07 /* DetectJava.swift in Sources */,
BF07789E21506D2B0014EB07 /* PopoverViewController.swift in Sources */, BF07789E21506D2B0014EB07 /* PopoverViewController.swift in Sources */,
BF650CAB2152AC7D0014EB07 /* Deployer.m in Sources */,
BF1EFA40215141110014EB07 /* main.mm in Sources */, BF1EFA40215141110014EB07 /* main.mm in Sources */,
BFBDCAF4215042670014EB07 /* AppleStuffExceptionHandler.m in Sources */, BFBDCAF4215042670014EB07 /* AppleStuffExceptionHandler.m in Sources */,
BF531515215105B40014EB07 /* LogViewController.swift in Sources */, BF531515215105B40014EB07 /* LogViewController.swift in Sources */,
...@@ -358,7 +385,7 @@ ...@@ -358,7 +385,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_ARC = NO;
CLANG_ENABLE_OBJC_WEAK = YES; CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_BOOL_CONVERSION = YES;
...@@ -400,10 +427,10 @@ ...@@ -400,10 +427,10 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.13; MACOSX_DEPLOYMENT_TARGET = 10.11;
MTL_ENABLE_DEBUG_INFO = YES; MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx; SDKROOT = macosx10.13;
}; };
name = Debug; name = Debug;
}; };
...@@ -416,7 +443,7 @@ ...@@ -416,7 +443,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_ARC = NO;
CLANG_ENABLE_OBJC_WEAK = YES; CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_BOOL_CONVERSION = YES;
...@@ -452,80 +479,80 @@ ...@@ -452,80 +479,80 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.13; MACOSX_DEPLOYMENT_TARGET = 10.11;
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx; SDKROOT = macosx10.13;
SWIFT_COMPILATION_MODE = wholemodule;
}; };
name = Release; name = Release;
}; };
BF50617D2113C4900014EB07 /* Debug */ = { BF50617D2113C4900014EB07 /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = NO;
CODE_SIGN_ENTITLEMENTS = I2PLauncher/I2PLauncher.entitlements; CODE_SIGN_ENTITLEMENTS = I2PLauncher/I2PLauncher.entitlements;
CODE_SIGN_IDENTITY = "Mac Developer"; CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = W3C42P2LA8; DEAD_CODE_STRIPPING = YES;
GCC_C_LANGUAGE_STANDARD = gnu11; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = DTX4Q6WZN2;
FRAMEWORK_SEARCH_PATHS = (
/Library/Frameworks,
/System/Library/Frameworks,
);
HEADER_SEARCH_PATHS = ( HEADER_SEARCH_PATHS = (
"$(SRCROOT)/include", "$(SRCROOT)/include",
"$(SRCROOT)/include/neither", "$(SRCROOT)/include/neither",
); );
INCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES = include; INCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES = include;
INFOPLIST_FILE = I2PLauncher/Info.plist; INFOPLIST_FILE = I2PLauncher/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_NO_PIE = YES;
"$(inherited)", LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @executable_path/Frameworks";
"@executable_path/../Frameworks", MACOSX_DEPLOYMENT_TARGET = 10.11;
); PRODUCT_BUNDLE_IDENTIFIER = net.i2p.bootstrap.macosx.I2PLauncher;
MACOSX_DEPLOYMENT_TARGET = 10.10;
PRODUCT_BUNDLE_IDENTIFIER = net.i2p.launcher.I2PLauncher;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = macosx;
SWIFT_OBJC_BRIDGING_HEADER = "I2PLauncher/I2PLauncher-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "I2PLauncher/I2PLauncher-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0; SWIFT_VERSION = 3.0;
SYSTEM_HEADER_SEARCH_PATHS = "$(SRCROOT)/include/**"; SYSTEM_HEADER_SEARCH_PATHS = "$(SRCROOT)/include/**";
USER_HEADER_SEARCH_PATHS = "";
}; };
name = Debug; name = Debug;
}; };
BF50617E2113C4900014EB07 /* Release */ = { BF50617E2113C4900014EB07 /* Release */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = NO;
CODE_SIGN_ENTITLEMENTS = I2PLauncher/I2PLauncher.entitlements; CODE_SIGN_ENTITLEMENTS = I2PLauncher/I2PLauncher.entitlements;
CODE_SIGN_IDENTITY = "Mac Developer"; CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = W3C42P2LA8; DEAD_CODE_STRIPPING = YES;
GCC_C_LANGUAGE_STANDARD = gnu11; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = DTX4Q6WZN2;
FRAMEWORK_SEARCH_PATHS = (
/Library/Frameworks,
/System/Library/Frameworks,
);
HEADER_SEARCH_PATHS = ( HEADER_SEARCH_PATHS = (
"$(SRCROOT)/include", "$(SRCROOT)/include",
"$(SRCROOT)/include/neither", "$(SRCROOT)/include/neither",
); );
INCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES = include; INCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES = include;
INFOPLIST_FILE = I2PLauncher/Info.plist; INFOPLIST_FILE = I2PLauncher/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_NO_PIE = YES;
"$(inherited)", LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @executable_path/Frameworks";
"@executable_path/../Frameworks", MACOSX_DEPLOYMENT_TARGET = 10.11;
); PRODUCT_BUNDLE_IDENTIFIER = net.i2p.bootstrap.macosx.I2PLauncher;
MACOSX_DEPLOYMENT_TARGET = 10.10;
PRODUCT_BUNDLE_IDENTIFIER = net.i2p.launcher.I2PLauncher;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = macosx;
SWIFT_OBJC_BRIDGING_HEADER = "I2PLauncher/I2PLauncher-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "I2PLauncher/I2PLauncher-Bridging-Header.h";
SWIFT_VERSION = 3.0; SWIFT_VERSION = 3.0;
SYSTEM_HEADER_SEARCH_PATHS = "$(SRCROOT)/include/**"; SYSTEM_HEADER_SEARCH_PATHS = "$(SRCROOT)/include/**";
USER_HEADER_SEARCH_PATHS = "";
}; };
name = Release; name = Release;
}; };
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Workspace <Workspace
version = "1.0"> version = "1.0">
<FileRef
location = "group:RouterService/RouterService.xcodeproj">
</FileRef>
<FileRef <FileRef
location = "group:I2PLauncher.xcodeproj"> location = "group:I2PLauncher.xcodeproj">
</FileRef> </FileRef>
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
</dict> </dict>
</array> </array>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>3</string> <string>4</string>
<key>LSApplicationCategoryType</key> <key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string> <string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>
...@@ -53,5 +53,7 @@ ...@@ -53,5 +53,7 @@
<array> <array>
<dict/> <dict/>
</array> </array>
<key>SUFeedURL</key>
<string>http://i2browser.i2p/updates/v1/appcast.xml</string>
</dict> </dict>
</plist> </plist>
# The Mac OS X Launcher # The Mac OS X Launcher
## Misc
**Note** this project is WIP, cause Meeh has yet to merge in Obj-C/Swift code for GUI stuff in OSX. **Note** this project is WIP, cause Meeh has yet to merge in Obj-C/Swift code for GUI stuff in OSX.
However, this is a thin wrapper launching both Mac OS X trayicon and the I2P router - and make them talk together. However, this is a thin wrapper launching both Mac OS X trayicon and the I2P router - and make them talk together.
More code will be merged in, it's just a f* mess which Meeh needs to clean up and move into repo. More code will be merged in, it's just a f* mess which Meeh needs to clean up and move into repo.
`./fullBuild.sh` triggers Ant jobs and prepare the base.zip, as well as starting the ninja build. ## Howto build
You can both build the project from the Xcode UI or you can build it from command line.
An example build command:
`xcodebuild -target I2PLauncher -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk`
...@@ -49,18 +49,16 @@ ...@@ -49,18 +49,16 @@
name:NSFileHandleDataAvailableNotification name:NSFileHandleDataAvailableNotification
object:stdoutFileHandle]; object:stdoutFileHandle];
[stdoutFileHandle waitForDataInBackgroundAndNotify]; [stdoutFileHandle waitForDataInBackgroundAndNotify];
[self.routerTask setTerminationHandler:^(NSTask* task) { [self.routerTask setTerminationHandler:^(NSTask* task) {
NSLog(@"termHandler triggered!"); NSLog(@"termHandler triggered!");
auto swiftRouterStatus = [[RouterProcessStatus alloc] init]; auto swiftRouterStatus = [[RouterProcessStatus alloc] init];
[swiftRouterStatus setRouterStatus: true]; [swiftRouterStatus setRouterStatus: true];
NSBundle *launcherBundle = [NSBundle mainBundle]; sendUserNotification(APP_IDSTR, @"I2P Router has stopped");
auto iconImage = [launcherBundle pathForResource:@"AppIcon" ofType:@"png"]; // Cleanup
sendUserNotification(APP_IDSTR, @"I2P Router has stopped"); //self.isRouterRunning = NO;
// Cleanup }];
self.isRouterRunning = NO;
}];
/* /*
self.readLogHandle = [self.processPipe fileHandleForReading]; self.readLogHandle = [self.processPipe fileHandleForReading];
NSData *inData = nil; NSData *inData = nil;
......
//
// SBridge.h
// I2PLauncher
//
// Created by Mikal Villa on 18/09/2018.
// Copyright © 2018 The I2P Project. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface SBridge : NSObject
- (NSString*) buildClassPath:(NSString*)i2pPath;
- (void) startupI2PRouter:(NSString*)i2pRootPath javaBinPath:(NSString*)javaBinPath;
- (void) openUrl:(NSString*)url;
@end
//
// SBridge.m
// I2PLauncher
//
// Created by Mikal Villa on 18/09/2018.
// Copyright © 2018 The I2P Project. All rights reserved.
//
#import "SBridge.h"
#ifdef __cplusplus
#include <functional>
#include <memory>
#include <glob.h>
#include <string>
#include <list>
#include <stdlib.h>
#include <future>
#include <vector>
#import <AppKit/AppKit.h>
#import "I2PLauncher-Swift.h"
#include "AppDelegate.h"
#include "include/fn.h"
std::future<int> startupRouter(NSString* javaBin, NSArray<NSString*>* arguments, NSString* i2pBaseDir) {
@try {
RTaskOptions* options = [RTaskOptions alloc];
options.binPath = javaBin;
options.arguments = arguments;
options.i2pBaseDir = i2pBaseDir;
auto instance = [[I2PRouterTask alloc] initWithOptions: options];
//setGlobalRouterObject(instance);
//NSThread *thr = [[NSThread alloc] initWithTarget:instance selector:@selector(execute) object:nil];
[instance execute];
sendUserNotification(APP_IDSTR, @"The I2P router is starting up.");
auto pid = [instance getPID];
return std::async(std::launch::async, [&pid]{
return pid;
});
}
@catch (NSException *e)
{
auto errStr = [NSString stringWithFormat:@"Expection occurred %@",[e reason]];
NSLog(@"%@", errStr);
sendUserNotification(APP_IDSTR, errStr);
return std::async(std::launch::async, [&]{
return 0;
});
}
}
namespace osx {
inline void openUrl(NSString* url)
{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString: url]];
}
}
inline std::vector<std::string> globVector(const std::string& pattern){
glob_t glob_result;
glob(pattern.c_str(),GLOB_TILDE,NULL,&glob_result);
std::vector<std::string> files;
for(unsigned int i=0;i<glob_result.gl_pathc;++i){
files.push_back(std::string(glob_result.gl_pathv[i]));
}
globfree(&glob_result);
return files;
}
inline std::string buildClassPathForObjC(std::string basePath)
{
NSBundle *launcherBundle = [NSBundle mainBundle];
auto jarList = globVector(basePath+std::string("/lib/*.jar"));
std::string classpathStrHead = "-classpath";
std::string classpathStr = "";
classpathStr += [[launcherBundle pathForResource:@"launcher" ofType:@"jar"] UTF8String];
std::string prefix(basePath);
prefix += "/lib/";
for_each(jarList, [&classpathStr](std::string str){ classpathStr += std::string(":") + str; });
return classpathStr;
}
@implementation SBridge
- (void) openUrl:(NSString*)url
{
osx::openUrl(url);
}
- (NSString*) buildClassPath:(NSString*)i2pPath
{
const char * basePath = [i2pPath UTF8String];
auto jarList = buildClassPathForObjC(basePath);
const char * classpath = jarList.c_str();
NSLog(@"Classpath from ObjC = %s", classpath);
return [[NSString alloc] initWithUTF8String:classpath];
}
- (void)startupI2PRouter:(NSString*)i2pRootPath javaBinPath:(NSString*)javaBinPath
{
std::string basePath([i2pRootPath UTF8String]);
// Get paths
//NSBundle *launcherBundle = [NSBundle mainBundle];
auto classPathStr = buildClassPathForObjC(basePath);
RouterProcessStatus* routerStatus = [[RouterProcessStatus alloc] init];
try {
std::vector<NSString*> argList = {
@"-Xmx512M",
@"-Xms128m",
@"-Djava.awt.headless=true",
@"-Dwrapper.logfile=/tmp/router.log",
@"-Dwrapper.logfile.loglevel=DEBUG",
@"-Dwrapper.java.pidfile=/tmp/routerjvm.pid",
@"-Dwrapper.console.loglevel=DEBUG"
};
std::string baseDirArg("-Di2p.dir.base=");
baseDirArg += basePath;
std::string javaLibArg("-Djava.library.path=");
javaLibArg += basePath;
// TODO: pass this to JVM
//auto java_opts = getenv("JAVA_OPTS");
std::string cpString = std::string("-cp");
argList.push_back([NSString stringWithUTF8String:baseDirArg.c_str()]);
argList.push_back([NSString stringWithUTF8String:javaLibArg.c_str()]);
argList.push_back([NSString stringWithUTF8String:cpString.c_str()]);
argList.push_back([NSString stringWithUTF8String:classPathStr.c_str()]);
argList.push_back(@"net.i2p.router.Router");
auto javaBin = std::string([javaBinPath UTF8String]);
sendUserNotification(APP_IDSTR, @"I2P Router is starting up!");
auto nsJavaBin = javaBinPath;
auto nsBasePath = i2pRootPath;
NSArray* arrArguments = [NSArray arrayWithObjects:&argList[0] count:argList.size()];
// We don't really know yet, but per now a workaround
[routerStatus setRouterStatus: true];
NSLog(@"Trying to run command: %@", javaBinPath);
NSLog(@"With I2P Base dir: %@", i2pRootPath);
NSLog(@"And Arguments: %@", arrArguments);
startupRouter(nsJavaBin, arrArguments, nsBasePath);
} catch (std::exception &err) {
auto errMsg = [NSString stringWithUTF8String:err.what()];
NSLog(@"Exception: %@", errMsg);
sendUserNotification(APP_IDSTR, [NSString stringWithFormat:@"Error: %@", errMsg]);
[routerStatus setRouterStatus: false];
[routerStatus setRouterRanByUs: false];
}
}
@end
#endif
...@@ -53,7 +53,7 @@ inline std::string extractString(CFStringRef value) ...@@ -53,7 +53,7 @@ inline std::string extractString(CFStringRef value)
} }
} }
bool replace(std::string& str, const std::string& from, const std::string& to) { inline bool replace(std::string& str, const std::string& from, const std::string& to) {
size_t start_pos = str.find(from); size_t start_pos = str.find(from);
if(start_pos == std::string::npos) if(start_pos == std::string::npos)
return false; return false;
......
...@@ -34,31 +34,26 @@ ...@@ -34,31 +34,26 @@
#include "include/fn.h" #include "include/fn.h"
#include "include/portcheck.h" #include "include/portcheck.h"
#define debug(format, ...) CFShow([NSString stringWithFormat:format, ## __VA_ARGS__]);
@interface AppDelegate () <NSUserNotificationCenterDelegate, NSApplicationDelegate>
@end
#ifdef __cplusplus #ifdef __cplusplus
#import "SBridge.h" #import "SBridge.h"
JvmListSharedPtr gRawJvmList = nullptr;
#endif
#include "include/subprocess.hpp"
#include "include/strutil.hpp"
using namespace subprocess;
@interface AppDelegate () <NSUserNotificationCenterDelegate, NSApplicationDelegate> JvmListSharedPtr gRawJvmList = nullptr;
@end
#ifdef __cplusplus
maybeAnRouterRunner getGlobalRouterObject() maybeAnRouterRunner getGlobalRouterObject()
{ {
std::lock_guard<std::mutex> lock(globalRouterStatusMutex); std::lock_guard<std::mutex> lock(globalRouterStatusMutex);
return globalRouterStatus; // Remember this might be nullptr now. return globalRouterStatus; // Remember this might be nullptr now.
} }
void setGlobalRouterObject(I2PRouterTask* newRouter) void setGlobalRouterObject(I2PRouterTask* newRouter)
{ {
std::lock_guard<std::mutex> lock(globalRouterStatusMutex); std::lock_guard<std::mutex> lock(globalRouterStatusMutex);
globalRouterStatus = newRouter; globalRouterStatus = newRouter;
} }
...@@ -66,20 +61,25 @@ pthread_mutex_t mutex; ...@@ -66,20 +61,25 @@ pthread_mutex_t mutex;
bool getGlobalRouterIsRunning() bool getGlobalRouterIsRunning()
{ {
pthread_mutex_lock(&mutex); pthread_mutex_lock(&mutex);
bool current = isRuterRunning; bool current = isRuterRunning;
pthread_mutex_unlock(&mutex); pthread_mutex_unlock(&mutex);
return current; return current;
} }
void setGlobalRouterIsRunning(bool running) void setGlobalRouterIsRunning(bool running)
{ {
pthread_mutex_lock(&mutex); pthread_mutex_lock(&mutex);
isRuterRunning = running; isRuterRunning = running;
pthread_mutex_unlock(&mutex); pthread_mutex_unlock(&mutex);
} }
#endif #endif
#define debug(format, ...) CFShow([NSString stringWithFormat:format, ## __VA_ARGS__]);
@interface AppDelegate () <NSUserNotificationCenterDelegate, NSApplicationDelegate>
@end
@implementation ExtractMetaInfo : NSObject @implementation ExtractMetaInfo : NSObject
@end @end
...@@ -92,22 +92,6 @@ void setGlobalRouterIsRunning(bool running) ...@@ -92,22 +92,6 @@ void setGlobalRouterIsRunning(bool running)
#ifdef __cplusplus #ifdef __cplusplus
#include <unistd.h>
#include <sys/types.h>
#include <pwd.h>
#include <assert.h>
#include "include/subprocess.hpp"
#include "include/strutil.hpp"
using namespace subprocess;
const char* RealHomeDirectory() {
struct passwd *pw = getpwuid(getuid());
assert(pw);
return pw->pw_dir;
}
- (void)extractI2PBaseDir:(void(^)(BOOL success, NSError *error))completion - (void)extractI2PBaseDir:(void(^)(BOOL success, NSError *error))completion
{ {
...@@ -223,17 +207,6 @@ const char* RealHomeDirectory() { ...@@ -223,17 +207,6 @@ const char* RealHomeDirectory() {
#ifdef __cplusplus #ifdef __cplusplus
inline std::string getDefaultBaseDir()
{
// Figure out base directory
const char* pathFromHome = "/Users/%s/Library/I2P";
auto username = getenv("USER");
char buffer[strlen(pathFromHome)+strlen(username)];
sprintf(buffer, pathFromHome, username);
std::string i2pBaseDir(buffer);
return i2pBaseDir;
}
- (NSString *)userSelectJavaHome:(JvmListPtr)rawJvmList - (NSString *)userSelectJavaHome:(JvmListPtr)rawJvmList
{ {
NSString *appleScriptString = @"set jvmlist to {\"Newest\""; NSString *appleScriptString = @"set jvmlist to {\"Newest\"";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment