␊ |
@implementation PartitionInfoElement␊ |
␊ |
@synthesize descDict, bsdName, vUUID, vKind, vName, mediaPath, mediaRemovable, devInternal, devProtocol;␊ |
@synthesize descDict, bsdName, vUUID, vKind, vName, vPath, mediaPath, mediaRemovable, devInternal, devProtocol;␊ |
@synthesize vAliasName, hidden;␊ |
␊ |
/// Create a list of all bsd partitions␊ |
|
␉␉␊ |
␉␉self.vUUID = [self stringValueWithKey: @"DAVolumeUUID"];␊ |
␉␉self.vName = [self stringValueWithKey: @"DAVolumeName"];␊ |
␉␉self.vPath = [self stringValueWithKey: @"DAVolumePath"];␊ |
␉␉if (self.vName == nil || [vName length]==0)␊ |
␉␉␉self.vName = [self.vPath lastPathComponent ];␊ |
␉␉self.vAliasName = self.vName; // by default renamed = original part name ␊ |
␉␉self.vKind = [self stringValueWithKey: @"DAVolumeKind"];␊ |
␉␉self.mediaPath = [self stringValueWithKey: @"DAMediaPath"];␊ |
|
␉bool bootable = false;␊ |
␉NSFileManager* mgr = [NSFileManager defaultManager];␊ |
␉NSString *fmt = @"/Volumes/%@%s";␊ |
␉NSRange r = [vPath rangeOfString:@"file://localhost/Volumes/"];␊ |
␉NSString * vol = [NSString stringWithFormat: @"%@/",vName];␊ |
␉␊ |
␉// ␊ |
␉if (r.location != NSNotFound) {␊ |
␉␉vol = [[vPath substringFromIndex:r.location+r.length] stringByReplacingOccurrencesOfString:@"%20" withString:@" "];␊ |
␉}␊ |
␉␊ |
␉// that Windows is the name of WIN32 bootable disk dir ...␊ |
␉if(␊ |
␉␉[mgr fileExistsAtPath: [NSString stringWithFormat: fmt, vName, "/System/Library/Extensions" ]] ||␊ |
␉ [mgr fileExistsAtPath: [NSString stringWithFormat: fmt, vName, "/ntldr" ]] ||␊ |
␉␉[mgr fileExistsAtPath: [NSString stringWithFormat: fmt, vName, "/bootmgr" ]] ||␊ |
␉␉[mgr fileExistsAtPath: [NSString stringWithFormat: fmt, vName, "/boot/bcd" ]] ||␊ |
␉␉[mgr fileExistsAtPath: [NSString stringWithFormat: fmt, vName, "/pagefile.sys" ]] ||␊ |
␉␉[mgr fileExistsAtPath: [NSString stringWithFormat: fmt, vName, "/hiberfil.sys" ]] ␊ |
␉␉[mgr fileExistsAtPath: [NSString stringWithFormat: fmt, vol, "System/Library/Extensions" ]] ||␊ |
␉ [mgr fileExistsAtPath: [NSString stringWithFormat: fmt, vol, "ntldr" ]] ||␊ |
␉␉[mgr fileExistsAtPath: [NSString stringWithFormat: fmt, vol, "bootmgr" ]] ||␊ |
␉␉[mgr fileExistsAtPath: [NSString stringWithFormat: fmt, vol, "boot/bcd" ]] ||␊ |
␉␉[mgr fileExistsAtPath: [NSString stringWithFormat: fmt, vol, "pagefile.sys" ]] ||␊ |
␉␉[mgr fileExistsAtPath: [NSString stringWithFormat: fmt, vol, "hiberfil.sys" ]] ␊ |
␉ )␊ |
␉␉bootable=true;␊ |
␉else if ([vName rangeOfString:@"ext"].location != NSNotFound) // linux ?␊ |
|
␉@"(\n"␊ |
␉ " bsdName %@\n deviceProtocol %@\n deviceInternal %i\n"␊ |
␉ " volumeName %@\n volumeKind %@\n volumeUUID %@\n"␊ |
␉ " mediaPath %@\n mediaRemovable %i\n"␉␊ |
␉ " volumePath %@\n mediaPath %@\n mediaRemovable %i\n"␉␊ |
␉ ")";␊ |
␉NSString* value = [NSString stringWithFormat: format,␊ |
␉␉␉␉␉ self.bsdName, self.devProtocol, self.devInternal, ␊ |
␉␉␉␉␉ self.vName, self.vKind, self.vUUID, ␊ |
␉␉␉␉␉ self.mediaPath, self.mediaRemovable ];␊ |
␉␉␉␉␉ self.vPath, self.mediaPath, self.mediaRemovable ];␊ |
␉return value;␊ |
}␊ |
␊ |