Ignore:
Timestamp:
Sep 19, 2018 5:00:17 PM (2 years ago)
Author:
meeh <meeh@…>
Branches:
master
Children:
0f8a618
Parents:
802115e
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • launchers/macosx/main.mm

    r802115e re046418f  
    3535#include "include/portcheck.h"
    3636
     37#ifdef __cplusplus
     38#import "SBridge.h"
     39
     40#include "include/subprocess.hpp"
     41#include "include/strutil.hpp"
     42
     43using namespace subprocess;
     44
     45JvmListSharedPtr gRawJvmList = nullptr;
     46
     47maybeAnRouterRunner getGlobalRouterObject()
     48{
     49  std::lock_guard<std::mutex> lock(globalRouterStatusMutex);
     50  return globalRouterStatus; // Remember this might be nullptr now.
     51}
     52
     53void setGlobalRouterObject(I2PRouterTask* newRouter)
     54{
     55  std::lock_guard<std::mutex> lock(globalRouterStatusMutex);
     56  globalRouterStatus = newRouter;
     57}
     58
     59
     60pthread_mutex_t mutex;
     61
     62bool getGlobalRouterIsRunning()
     63{
     64  pthread_mutex_lock(&mutex);
     65  bool current = isRuterRunning;
     66  pthread_mutex_unlock(&mutex);
     67  return current;
     68}
     69void setGlobalRouterIsRunning(bool running)
     70{
     71  pthread_mutex_lock(&mutex);
     72  isRuterRunning = running;
     73  pthread_mutex_unlock(&mutex);
     74}
     75
     76#endif
     77
    3778#define debug(format, ...) CFShow([NSString stringWithFormat:format, ## __VA_ARGS__]);
    3879
     
    4081@end
    4182
    42 #ifdef __cplusplus
    43 #import "SBridge.h"
    44 JvmListSharedPtr gRawJvmList = nullptr;
    45 #endif
    46 
    47 
    48 @interface AppDelegate () <NSUserNotificationCenterDelegate, NSApplicationDelegate>
    49 @end
    50 
    51 #ifdef __cplusplus
    52 maybeAnRouterRunner getGlobalRouterObject()
    53 {
    54     std::lock_guard<std::mutex> lock(globalRouterStatusMutex);
    55     return globalRouterStatus; // Remember this might be nullptr now.
    56 }
    57 
    58 void setGlobalRouterObject(I2PRouterTask* newRouter)
    59 {
    60     std::lock_guard<std::mutex> lock(globalRouterStatusMutex);
    61     globalRouterStatus = newRouter;
    62 }
    63 
    64 
    65 pthread_mutex_t mutex;
    66 
    67 bool getGlobalRouterIsRunning()
    68 {
    69     pthread_mutex_lock(&mutex);
    70     bool current = isRuterRunning;
    71     pthread_mutex_unlock(&mutex);
    72     return current;
    73 }
    74 void setGlobalRouterIsRunning(bool running)
    75 {
    76     pthread_mutex_lock(&mutex);
    77     isRuterRunning = running;
    78     pthread_mutex_unlock(&mutex);
    79 }
    80 
    81 #endif
    82 
    8383
    8484@implementation ExtractMetaInfo : NSObject
     
    9292
    9393#ifdef __cplusplus
    94 
    95 #include <unistd.h>
    96 #include <sys/types.h>
    97 #include <pwd.h>
    98 #include <assert.h>
    99 
    100 #include "include/subprocess.hpp"
    101 #include "include/strutil.hpp"
    102 
    103 using namespace subprocess;
    104 
    105 const char* RealHomeDirectory() {
    106   struct passwd *pw = getpwuid(getuid());
    107   assert(pw);
    108   return pw->pw_dir;
    109 }
    11094
    11195- (void)extractI2PBaseDir:(void(^)(BOOL success, NSError *error))completion
     
    223207
    224208#ifdef __cplusplus
    225 
    226 inline std::string getDefaultBaseDir()
    227 {
    228   // Figure out base directory
    229   const char* pathFromHome = "/Users/%s/Library/I2P";
    230   auto username = getenv("USER");
    231   char buffer[strlen(pathFromHome)+strlen(username)];
    232   sprintf(buffer, pathFromHome, username);
    233   std::string i2pBaseDir(buffer);
    234   return i2pBaseDir;
    235 }
    236209
    237210- (NSString *)userSelectJavaHome:(JvmListPtr)rawJvmList
Note: See TracChangeset for help on using the changeset viewer.