mirror of
https://github.com/somegeekintn/SimDirs.git
synced 2026-04-26 14:47:41 +00:00
add mobile_installation.log scan back
This commit is contained in:
parent
25c8ebd36e
commit
2d8d365e25
3 changed files with 89 additions and 29 deletions
|
|
@ -17,7 +17,7 @@
|
|||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.3</string>
|
||||
<string>0.3.1</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
|
|
|||
|
|
@ -40,16 +40,8 @@
|
|||
|
||||
- (void) updateFromLastLaunchMapInfo: (NSDictionary *) inMapInfo
|
||||
{
|
||||
NSString *path;
|
||||
|
||||
path = inMapInfo[@"BundleContainer"];
|
||||
if (self.bundlePath == nil && [self testPath: path]) {
|
||||
self.bundlePath = path;
|
||||
}
|
||||
path = inMapInfo[@"Container"];
|
||||
if (self.sandBoxPath == nil && [self testPath: path]) {
|
||||
self.sandBoxPath = path;
|
||||
}
|
||||
self.bundlePath = inMapInfo[@"BundleContainer"];
|
||||
self.sandBoxPath = inMapInfo[@"Container"];
|
||||
}
|
||||
|
||||
- (void) updateFromAppStateInfo: (NSDictionary *) inStateInfo
|
||||
|
|
@ -57,16 +49,8 @@
|
|||
NSDictionary *compatInfo = inStateInfo[@"compatibilityInfo"];
|
||||
|
||||
if (compatInfo != nil) {
|
||||
NSString *path;
|
||||
|
||||
path = compatInfo[@"bundlePath"];
|
||||
if (self.bundlePath == nil && [self testPath: path]) {
|
||||
self.bundlePath = path;
|
||||
}
|
||||
path = compatInfo[@"sandboxPath"];
|
||||
if (self.sandBoxPath == nil && [self testPath: path]) {
|
||||
self.sandBoxPath = path;
|
||||
}
|
||||
self.bundlePath = compatInfo[@"bundlePath"];
|
||||
self.sandBoxPath = compatInfo[@"sandboxPath"];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -85,7 +69,9 @@
|
|||
NSString *appPath = [appURL path];
|
||||
|
||||
if ([[appPath lastPathComponent] rangeOfString: @".app"].location != NSNotFound) {
|
||||
self.bundlePath = appPath;
|
||||
// setter won't let us reset so access ivar directly
|
||||
_bundlePath = appPath;
|
||||
_childItems = nil;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -246,14 +232,18 @@
|
|||
|
||||
- (void) setBundlePath: (NSString *) inBundlePath
|
||||
{
|
||||
_bundlePath = inBundlePath;
|
||||
_childItems = nil;
|
||||
if (_bundlePath == nil && [self testPath: inBundlePath]) {
|
||||
_bundlePath = inBundlePath;
|
||||
_childItems = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (void) setSandBoxPath: (NSString *) inSandBoxPath
|
||||
{
|
||||
_sandBoxPath = inSandBoxPath;
|
||||
_childItems = nil;
|
||||
if (_sandBoxPath == nil && [self testPath: inSandBoxPath]) {
|
||||
_sandBoxPath = inSandBoxPath;
|
||||
_childItems = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString *) title
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@
|
|||
|
||||
[self gatherAppInfoFromLastLaunchMap];
|
||||
[self gatherAppInfoFromAppState];
|
||||
[self gatherAppInfoFromInstallLogs];
|
||||
[self cleanupAndRefineAppList];
|
||||
|
||||
initOK = YES;
|
||||
|
|
@ -129,10 +130,10 @@
|
|||
- (void) gatherAppInfoFromAppState
|
||||
{
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
NSURL *apStateInfoURL = [self.baseURL URLByAppendingPathComponent: @"data/Library/BackBoard/applicationState.plist"];
|
||||
NSURL *appStateInfoURL = [self.baseURL URLByAppendingPathComponent: @"data/Library/BackBoard/applicationState.plist"];
|
||||
|
||||
if (apStateInfoURL != nil && [fileManager fileExistsAtPath: [apStateInfoURL path]]) {
|
||||
NSData *plistData = [NSData dataWithContentsOfURL: apStateInfoURL];
|
||||
if (appStateInfoURL != nil && [fileManager fileExistsAtPath: [appStateInfoURL path]]) {
|
||||
NSData *plistData = [NSData dataWithContentsOfURL: appStateInfoURL];
|
||||
NSDictionary *stateInfo;
|
||||
|
||||
stateInfo = [NSPropertyListSerialization propertyListWithData: plistData options: NSPropertyListImmutable format: nil error: nil];
|
||||
|
|
@ -149,6 +150,75 @@
|
|||
}
|
||||
}
|
||||
|
||||
// mobile_installation.log.0 is my least favorite, most fragile way to scan for app installations
|
||||
// try this after everything else
|
||||
- (void) gatherAppInfoFromInstallLogs
|
||||
{
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
NSURL *installLogURL = [self.baseURL URLByAppendingPathComponent: @"data/Library/Logs/MobileInstallation/mobile_installation.log.0"];
|
||||
|
||||
if (installLogURL != nil && [fileManager fileExistsAtPath: [installLogURL path]]) {
|
||||
NSString *installLog = [[NSString alloc] initWithContentsOfURL: installLogURL usedEncoding: nil error: nil];
|
||||
|
||||
if (installLog != nil) {
|
||||
// check these from most recent to oldest
|
||||
for (NSString *line in [[installLog componentsSeparatedByCharactersInSet: [NSCharacterSet newlineCharacterSet]] reverseObjectEnumerator]) {
|
||||
if ([line rangeOfString: @"com.apple"].location == NSNotFound) {
|
||||
NSRange logHintRange;
|
||||
|
||||
logHintRange = [line rangeOfString: @"makeContainerLiveReplacingContainer"];
|
||||
if (logHintRange.location != NSNotFound) {
|
||||
[self extractBundleLocationFromLogEntry: line];
|
||||
}
|
||||
|
||||
logHintRange = [line rangeOfString: @"_refreshUUIDForContainer"];
|
||||
if (logHintRange.location != NSNotFound) {
|
||||
[self extractSandboxLocationFromLogEntry: line];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void) extractBundleLocationFromLogEntry: (NSString *) inLine
|
||||
{
|
||||
NSArray *logComponents = [inLine componentsSeparatedByString: @" "];
|
||||
NSString *bundlePath = [logComponents lastObject];
|
||||
|
||||
if (bundlePath != nil) {
|
||||
NSInteger bundleIDIndex = [logComponents count] - 3;
|
||||
|
||||
if (bundleIDIndex >= 0) {
|
||||
NSString *bundleID = [logComponents objectAtIndex: bundleIDIndex];
|
||||
QSSimAppInfo *appInfo = [self appInfoWithBundleID: bundleID];
|
||||
|
||||
if (appInfo != nil) {
|
||||
appInfo.bundlePath = bundlePath;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void) extractSandboxLocationFromLogEntry: (NSString *) inLine
|
||||
{
|
||||
NSArray *logComponents = [inLine componentsSeparatedByString: @" "];
|
||||
NSString *sandboxPath = [logComponents lastObject];
|
||||
|
||||
if (sandboxPath != nil) {
|
||||
NSInteger bundleIDIndex = [logComponents count] - 5;
|
||||
|
||||
if (bundleIDIndex >= 0) {
|
||||
NSString *bundleID = [logComponents objectAtIndex: bundleIDIndex];
|
||||
QSSimAppInfo *appInfo = [self appInfoWithBundleID: bundleID];
|
||||
|
||||
if (appInfo != nil) {
|
||||
appInfo.sandBoxPath = sandboxPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void) cleanupAndRefineAppList
|
||||
{
|
||||
NSMutableArray *mysteryApps = [NSMutableArray array];
|
||||
|
|
|
|||
Loading…
Reference in a new issue