Skip to content

Commit

Permalink
Log SC and system versions in Killer log
Browse files Browse the repository at this point in the history
  • Loading branch information
cstigler committed Oct 15, 2014
1 parent 020152a commit 48b6794
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 12 additions & 1 deletion SCKillerHelper/main.m
Expand Up @@ -10,6 +10,7 @@
#import <Cocoa/Cocoa.h>
#import <unistd.h>
#import "BlockManager.h"
#import "SelfControlUtilities.h"

#define LOG_FILE @"~/Documents/SelfControl-Killer.log"

Expand All @@ -33,6 +34,16 @@ int main(int argc, char* argv[]) {

/* FIRST TASK: print debug info */

// print SC version:
NSDictionary* infoDict = [[NSBundle mainBundle] infoDictionary];
NSString* version = [infoDict objectForKey:@"CFBundleShortVersionString"];
[log appendFormat: @"SelfControl Version: %@\n", version];

// print system version
unsigned int major, minor, bugfix;
[SelfControlUtilities getSystemVersionMajor: &major minor: &minor bugFix: &bugfix];
[log appendFormat: @"System Version: Mac OS X %d.%d.%d\n\n", major, minor, bugfix];

// print launchd daemons
int status;
NSTask* task;
Expand Down Expand Up @@ -79,7 +90,7 @@ int main(int argc, char* argv[]) {
if([fileManager fileExistsAtPath: @"/etc/SelfControl.lock"]) {
[log appendString: [NSString stringWithFormat: @"Found lock file with contents:\n\n%@\n\n", [NSString stringWithContentsOfFile: @"/etc/SelfControl.lock" encoding: NSUTF8StringEncoding error: NULL]]];
} else {
[log appendString: @"Could not find lock file.\n"];
[log appendString: @"Could not find lock file.\n\n"];
}

// print pf.conf
Expand Down
2 changes: 2 additions & 0 deletions SelfControl.xcodeproj/project.pbxproj
Expand Up @@ -37,6 +37,7 @@
CB25806816C237F10059C99A /* NSString+IPAddress.m in Sources */ = {isa = PBXBuildFile; fileRef = CB25806516C237F10059C99A /* NSString+IPAddress.m */; };
CB40A8680FBC7DE700167727 /* SelfControlBlocklist.icns in Resources */ = {isa = PBXBuildFile; fileRef = CB40A8670FBC7DE700167727 /* SelfControlBlocklist.icns */; };
CB4C58DA0F3F90B000B5D7CB /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = CB4C58D90F3F90B000B5D7CB /* Credits.rtf */; };
CB4ECC2419EF3A2A004E0F90 /* SelfControlUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = CB9C80DC19CF93EA00CDCAE1 /* SelfControlUtilities.m */; };
CB529BBF0F32B7ED00564FB8 /* AppController.m in Sources */ = {isa = PBXBuildFile; fileRef = CB529BBE0F32B7ED00564FB8 /* AppController.m */; };
CB54D44C0F93E33300AA22E9 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CB9E901D0F397FFA006DE6E4 /* Security.framework */; };
CB587E500F50FE8800C66A09 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CB587E4F0F50FE8800C66A09 /* SystemConfiguration.framework */; };
Expand Down Expand Up @@ -869,6 +870,7 @@
CB9C811E19CFBA8500CDCAE1 /* main.m in Sources */,
CB9C812719CFBB6400CDCAE1 /* NSString+IPAddress.m in Sources */,
CBE44FEB19E50900004E9706 /* WhitelistScraper.m in Sources */,
CB4ECC2419EF3A2A004E0F90 /* SelfControlUtilities.m in Sources */,
CB9C812619CFBB5E00CDCAE1 /* BlockManager.m in Sources */,
CB9C812519CFBB5500CDCAE1 /* HelperCommon.m in Sources */,
CB9C812419CFBB4E00CDCAE1 /* HostFileBlocker.m in Sources */,
Expand Down

0 comments on commit 48b6794

Please sign in to comment.