Chameleon Applications

Chameleon Applications Commit Details

Date:2011-12-12 02:43:17 (5 years 5 months ago)
Author:Rekursor
Commit:462
Parents: 461
Message:Implemented windows os info tooltip new feature
Changes:
M/trunk/ChameleonPrefPane/bin/OSX106/Chameleon.zip
M/trunk/ChameleonPrefPane/Sources/PartitionInfoElement.mm
M/trunk/ChameleonPrefPane/bin/version

File differences

trunk/ChameleonPrefPane/Sources/PartitionInfoElement.mm
4141
4242
4343
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
4459
4560
4661
4762
48
49
50
63
64
65
5166
5267
5368
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
5484
55
56
57
58
59
60
61
62
63
64
65
66
67
68
85
6986
7087
7188
......
333350
334351
335352
336
353
354
337355
338356
339357
return arr;
}
/// extract version info from boot files when possible
- (NSString*) cmdInfoForFile:(NSString*) file
withFilter:(NSString*) filter
withPath:(NSString*) path
{
std::string p = [path UTF8String];
p += [file UTF8String];
if (!fileExists(p)) return @"";
NSString *cmd = [NSString stringWithFormat:@"strings \"%@%@\" | sed -nE '%@'",
path, file, filter];
// NSLog(@"cmd to run is %@", cmd);
return [NSString stringWithUTF8String: ShellProcess([cmd UTF8String]).get_line().c_str()];
}
/// Get the boot information string, for chameleon only for now ...
-(NSString*) bootDescription
{
NSString* extractCmd = @"test -f \"%@boot\" && strings \"%@boot\" | sed -nE 's!^Darwin/x86 boot.+(Chameleon.+)!\\1!p'";
NSString* extractCmd2 = @"test -f \"%@mach_kernel\" && strings \"%@mach_kernel\" | sed -nE 's!^(Darwin Kernel Version.+)(\\: .*$)!\\1!p'";
NSString* localPath = [[self.vPath
if (bootInfo != nil) return bootInfo;
NSString* path = [[self.vPath
stringByReplacingOccurrencesOfString: @"file://localhost"
withString:@""]
stringByReplacingOccurrencesOfString:@"%20" withString:@" "];
NSString *cmdCham = [self cmdInfoForFile: @"boot"
withFilter: @"s!^Darwin/x86 boot.+(Chameleon.+)!\\1!p"
withPath: path];
NSString *cmdDarwin = [self cmdInfoForFile: @"mach_kernel"
withFilter: @"s!^(Darwin Kernel Version.+)(\\: .*$)!\\1!p"
withPath: path];
NSString *cmdWindows = (cmdDarwin==nil) ? @"" :
[self cmdInfoForFile: @"boot.ini"
withFilter: @"s!^multi.+WINDOWS=\\\"(.+)(\\\".+$)!\\1!p"
withPath: path];
NSString * result = [[cmdCham stringByAppendingString: cmdDarwin]
stringByAppendingString:cmdWindows];
result = [result stringByTrimmingCharactersInSet:
[NSCharacterSet whitespaceAndNewlineCharacterSet] ];
NSString* shellCmd = [NSString stringWithFormat:extractCmd, localPath, localPath ];
NSString* shellCmd2 = [NSString stringWithFormat:extractCmd2, localPath, localPath ];
std::string line = trim(ShellProcess([shellCmd UTF8String]).get_line(),"\n");
if (line.length()>0)
{
return [NSString stringWithUTF8String:line.c_str()];
}
else if ( (line=trim(ShellProcess([shellCmd2 UTF8String]).get_line(),"\n")).length()>0)
{
return [NSString stringWithUTF8String:line.c_str()];
}
else
return @"Unknown booter version";
return (bootInfo = [result length] > 0 ? result : nil);
}
if (mediaPath != nil) [mediaPath release];
if (devProtocol != nil) [devProtocol release];
if (vAliasName != nil) [vAliasName release];
bsdName = vUUID = vKind = vName = mediaPath = devProtocol = vAliasName = nil;
if (bootInfo != nil) [bootInfo release];
bsdName = vUUID = vKind = vName = mediaPath = devProtocol = vAliasName = bootInfo = nil;
descDict = nil;
}
trunk/ChameleonPrefPane/bin/version
1
1
Revision: 459
Revision: 461

Archive Download the corresponding diff file

Revision: 462