Index: trunk/ChameleonPrefPane/Sources/ShellProcess.cpp =================================================================== --- trunk/ChameleonPrefPane/Sources/ShellProcess.cpp (revision 459) +++ trunk/ChameleonPrefPane/Sources/ShellProcess.cpp (revision 460) @@ -10,6 +10,8 @@ #include #include "string_util.h" +#define MAX_LINESIZE 4096 + //---------------------------------------------------------------- // portable open process: FILE * ShellProcess::open(const char *cmd, const char *mode) { @@ -25,6 +27,16 @@ } //---------------------------------------------------------------- +std::string ShellProcess::get_line(const char * matching) +{ + char buffer[MAX_LINESIZE]; + + char* res = get_line(buffer, MAX_LINESIZE-1, matching); + std::string result = res ? res : ""; + + return result; +} +//---------------------------------------------------------------- char * ShellProcess::get_line(char * line, size_t s, const char *matching) { if (_fpt==NULL || line==NULL) return NULL; Index: trunk/ChameleonPrefPane/Sources/TableViewsController.mm =================================================================== --- trunk/ChameleonPrefPane/Sources/TableViewsController.mm (revision 459) +++ trunk/ChameleonPrefPane/Sources/TableViewsController.mm (revision 460) @@ -142,6 +142,25 @@ } //-------------------------------------------------------------------------- +- (NSString *)tableView: + (NSTableView *) tv + toolTipForCell:(NSCell *)aCell + rect:(NSRectPointer)rect + tableColumn:(NSTableColumn *)aTableColumn + row:(NSInteger)row + mouseLocation:(NSPoint)mouseLocation +{ + if (row<0) return nil; + + if (tv == mPartitionsTable) + { + PartitionInfoElement* partInfo = [PartsInfoMgr objectAtIndex: row]; + return [partInfo bootDescription]; + + } + return nil; +} + //-------------------------------------------------------------------------- - (void)tableViewSelectionDidChange:(NSNotification *)notification { Index: trunk/ChameleonPrefPane/Sources/PartitionInfoElement.h =================================================================== --- trunk/ChameleonPrefPane/Sources/PartitionInfoElement.h (revision 459) +++ trunk/ChameleonPrefPane/Sources/PartitionInfoElement.h (revision 460) @@ -10,10 +10,11 @@ @interface PartitionInfoElement : NSObject { NSString* bsdName; NSString *vUUID, *vName, *vPath, *vKind, *mediaPath, *devProtocol; + NSString *vAliasName; // for rename partition purpose + NSString *bootInfo; // for displaying partition info bool devInternal, mediaRemovable; NSDictionary* descDict; - NSString *vAliasName; // for rename partition purpose bool hidden; // for hide partition purpose int err; // non zero if problem occurred during info extraction int diskNum, partNum; @@ -28,6 +29,7 @@ @property (retain) NSString* vPath; @property (retain) NSString* mediaPath; @property (retain) NSString* devProtocol; +@property (retain) NSString* bootInfo; @property (assign) bool devInternal; @property (assign) bool mediaRemovable; @@ -52,6 +54,8 @@ // Get any DA attribute from dict -(NSString*) stringValueWithKey: (NSString*) key; +// Get the boot information string, for chameleon only for now ... +-(NSString*) bootDescription; -(int) diskNumber; -(int) partitionNumber; Index: trunk/ChameleonPrefPane/Sources/ShellProcess.h =================================================================== --- trunk/ChameleonPrefPane/Sources/ShellProcess.h (revision 459) +++ trunk/ChameleonPrefPane/Sources/ShellProcess.h (revision 460) @@ -38,7 +38,7 @@ /// Get the next line in the output, optionally skip lines until matching line is found char * get_line(char * line, size_t s, const char *matching=NULL); - + std::string get_line(const char * matching=NULL); /// encapsulates seek to beginning of file with optional relative offset bool seek_start(long offset=0L ) { Index: trunk/ChameleonPrefPane/Sources/PartitionInfoElement.mm =================================================================== --- trunk/ChameleonPrefPane/Sources/PartitionInfoElement.mm (revision 459) +++ trunk/ChameleonPrefPane/Sources/PartitionInfoElement.mm (revision 460) @@ -9,13 +9,14 @@ #import "PartitionInfoElement.h" #import "ShellProcess.h" +#include "string_util.h" static NSUInteger sHdRedirTable[MAX_HD]; @implementation PartitionInfoElement @synthesize descDict, bsdName, vUUID, vKind, vName, vPath, mediaPath, mediaRemovable, devInternal, devProtocol; -@synthesize vAliasName, hidden; +@synthesize vAliasName, hidden, bootInfo; /// Create a list of all bsd partitions +(NSArray*) createBSDPartitionList @@ -41,6 +42,33 @@ return arr; } +/// 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 + stringByReplacingOccurrencesOfString: @"file://localhost" + withString:@""] + stringByReplacingOccurrencesOfString:@"%20" withString:@" "]; + + 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"; +} + + /// redirection table for disk swapping +(NSUInteger*) hdRedirTable { Index: trunk/ChameleonPrefPane/bin/OSX106/Chameleon.zip =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: trunk/ChameleonPrefPane/bin/version =================================================================== --- trunk/ChameleonPrefPane/bin/version (revision 459) +++ trunk/ChameleonPrefPane/bin/version (revision 460) @@ -1 +1 @@ -Revision: 458 +Revision: 459 Index: trunk/ChameleonPrefPane/ChameleonPrefPane.xcodeproj/project.pbxproj =================================================================== --- trunk/ChameleonPrefPane/ChameleonPrefPane.xcodeproj/project.pbxproj (revision 459) +++ trunk/ChameleonPrefPane/ChameleonPrefPane.xcodeproj/project.pbxproj (revision 460) @@ -278,7 +278,6 @@ 01E314A9110FF91C0058F210 /* Controllers */, 01B0E80E1108B85A00ACF21B /* ChameleonPrefPane.h */, 01B0E80F1108B85A00ACF21B /* ChameleonPrefPane.mm */, - B3981D3F1113292A009E2520 /* CustomTableView.h */, 01A25D1B111108C80024EA7E /* CustomTableView.mm */, ); name = GUI; @@ -302,6 +301,7 @@ 01B0E8121108B85A00ACF21B /* PropertyList.cpp */, 01993565110AA9FA003B056E /* ChameleonPropertyList.h */, 01993566110AA9FA003B056E /* ChameleonPropertyList.cpp */, + B3981D3F1113292A009E2520 /* CustomTableView.h */, 01A25D20111108C80024EA7E /* KernOptionsParser.cpp */, 01A25D21111108C80024EA7E /* KernOptionsParser.h */, ); Index: trunk/ChameleonPrefPane/test_util/test_util.mm =================================================================== --- trunk/ChameleonPrefPane/test_util/test_util.mm (revision 459) +++ trunk/ChameleonPrefPane/test_util/test_util.mm (revision 460) @@ -53,16 +53,21 @@ { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; + // smbios extractio testing SmbiosExtractor* smbe = [[SmbiosExtractor alloc] init]; [smbe save:@"/tmp/chmIOreg.plist"]; NSLog(@"SMBIOS = \n%@", smbe); - + + // partitions extraction testing #if 1 NSArray* arr = [PartitionInfoElement createBSDPartitionList]; NSLog(@"List of existing bsd disk partitions:\n %@", arr); for (PartitionInfoElement* part in [PartsInfoMgr parts]) + { NSLog(@"PartionBootable = %i\n%@", (int) [part isBootable], part); + NSLog(@"boot info = %@", [part bootDescription] ) ; + } /* [PartsInfoMgr hideParts: @"\"Macintosh HD\" hd(0,3)"]; [PartsInfoMgr hideParts: @"disk0s2 hd(0,2) "]; @@ -77,6 +82,8 @@ testDiskInfoWith(@"disk0s2"); testDiskInfoWith(@"disk0s3"); #endif + + // flag substitutions testing fprintf(stderr, "String Test\n"); std::string options = "-v darkwake ab= a=0 =abc -f"; fprintf(stderr, "options = %s\n", options.c_str() ); @@ -92,6 +99,8 @@ << std::endl; } + + [pool drain]; return 0; }