"];
NSString *spfPath = @"";
NSString *spfPathDisplay = @"";
if([[tab objectForKey:@"isAbsolutePath"] boolValue]) {
spfPath = [tab objectForKey:@"path"];
if([spfPath hasPrefix:NSHomeDirectory()]) {
spfPathDisplay = [spfPath stringByReplacingOccurrencesOfString:NSHomeDirectory() withString:@"~"];
} else {
spfPathDisplay = spfPath;
}
spfPathDisplay = [NSString stringWithFormat:@" (%@)", spfPathDisplay];
} else {
spfPathDisplay = @"";
spfPath = [NSString stringWithFormat:@"%@/Contents/%@", [myURL path], [tab objectForKey:@"path"]];
}
if(spfPath == nil || ![spfPath length]) {
[spfsHTML appendString:@" ∅"];
continue;
}
// Get info.plist data as dictionary
NSDictionary *sessionSpf;
NSData *pData = [NSData dataWithContentsOfFile:spfPath options:NSUncachedRead error:&readError];
sessionSpf = [[NSPropertyListSerialization propertyListFromData:pData
mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&convError] retain];
if(!sessionSpf || readError != nil || [convError length] || !(format == NSPropertyListXMLFormat_v1_0 || format == NSPropertyListBinaryFormat_v1_0)) {
[spfsHTML appendFormat:@" %@ ∅", [tab objectForKey:@"path"]];
} else {
NSString *name = @"••••";
NSString *host = @"••••";
NSString *user = @"••••";
NSString *database = @"••••";
if([[sessionSpf objectForKey:@"data"] isKindOfClass:[NSDictionary class]]) {
if([[sessionSpf objectForKey:@"data"] objectForKey:@"connection"] && [[[sessionSpf objectForKey:@"data"] objectForKey:@"connection"] objectForKey:@"name"])
name = [[[sessionSpf objectForKey:@"data"] objectForKey:@"connection"] objectForKey:@"name"];
else
name = @"";
if([[sessionSpf objectForKey:@"data"] objectForKey:@"connection"] && [[[sessionSpf objectForKey:@"data"] objectForKey:@"connection"] objectForKey:@"host"])
host = [[[sessionSpf objectForKey:@"data"] objectForKey:@"connection"] objectForKey:@"host"];
else
host = @"";
if([[sessionSpf objectForKey:@"data"] objectForKey:@"connection"] && [[[sessionSpf objectForKey:@"data"] objectForKey:@"connection"] objectForKey:@"user"])
user = [[[sessionSpf objectForKey:@"data"] objectForKey:@"connection"] objectForKey:@"user"];
else
user = @"";
if([[sessionSpf objectForKey:@"data"] objectForKey:@"connection"] && [[[sessionSpf objectForKey:@"data"] objectForKey:@"connection"] objectForKey:@"database"])
database = [[[sessionSpf objectForKey:@"data"] objectForKey:@"connection"] objectForKey:@"database"];
else
database = @"";
}
[spfsHTML appendFormat:windowTemplate,
[sessionSpf objectForKey:@"rdbms_type"],
[sessionSpf objectForKey:@"rdbms_version"],
[name stringByReplacingOccurrencesOfString:@" " withString:@" "],
spfPathDisplay,
[host stringByReplacingOccurrencesOfString:@" " withString:@" "],
[user stringByReplacingOccurrencesOfString:@" " withString:@" "],
[database stringByReplacingOccurrencesOfString:@" " withString:@" "]
];
}
tabCounter++;
[spfsHTML appendString:@" |
"];
}
[spfsHTML appendString:@"