␉return szAlias;␊ |
␉␊ |
}␊ |
␊ |
// uncomment the following line for debug␊ |
#define DEBUG_DISKUTIL 0␊ |
␊ |
//----------------------------------------------------------------␊ |
const std::vector<PartitionInfo>& ␊ |
PartitionExtractor::extractPartitions(const char* szHide, const char* szRenamed)␊ |
|
␉_partList.clear();␊ |
␉if (szHide) hidePartitions(szHide);␊ |
␉if (szRenamed) renamedPartitions(szRenamed);␊ |
␊ |
#if DEBUG_DISKUTIL␊ |
␉this->open("cat /diskutil.txt");␊ |
#else␊ |
␉this->open("diskutil list");␊ |
#endif␊ |
␉␊ |
␉while(get_line(line, sizeof(line)-1))␊ |
␉{␊ |
|
␉␉if (sdisk)␊ |
␉␉{␊ |
␉␉␉// extract disk number␊ |
␉␉␉disk= sdisk[strlen(diskTag)]-'0';␊ |
␉␉␉sscanf(&sdisk[strlen(diskTag)],"%d", &disk);␊ |
␉␉␉if (disk>=0 && disk <MAX_HD)␊ |
␉␉␉␉disk = _hdRedirTable[disk];␊ |
␉␉}␊ |
|
␉␉␉␉partInfo.fsType()!="Apple_Free" ␊ |
␉␉␉␉)␊ |
␉␉␉{␊ |
␉␉␉␉std::string DiskLabel(label), UnixPath, WinPath; ␊ |
␉␉␉␉DiskLabel.erase( DiskLabel.find_last_not_of(" ") + 1);␊ |
␉␉␉␉std::string diskLabel(trim(label)); ␊ |
␉␉␉␉bool found=false;␊ |
␉␉␉␉␊ |
␉␉␉␉// early bail out if we found what we need:␊ |
␉␉␉␉if (fileExists((UnixPath = "/Volumes/" + DiskLabel + "/usr/bin/man"))) ␊ |
␉␉␉␉// early bail out if we found what we need: DON't make any assumption ␊ |
␉␉␉␉// that Windows is the name of WIN32 bootable disk dir ...␊ |
␉␉␉␉if (␊ |
␉␉␉␉␉fileExists("/Volumes/" + diskLabel + "/boot") || ␊ |
␉␉␉␉␉fileExists("/Volumes/" + diskLabel + "/System/Library/Extensions") ||␊ |
␉␉␉␉␉fileExists("/Volumes/" + diskLabel + "/ntldr") ||␊ |
␉␉␉␉␉fileExists("/Volumes/" + diskLabel + "/bootmgr") ||␊ |
␉␉␉␉␉fileExists("/Volumes/" + diskLabel + "/Boot") ||␊ |
␉␉␉␉␉fileExists("/Volumes/" + diskLabel + "/pagefile.sys") ||␊ |
␉␉␉␉␉fileExists("/Volumes/" + diskLabel + "/hiberfil.sys")␊ |
␉␉␉␉␉)␊ |
␉␉␉␉␉found=true;␊ |
␉␉␉␉else if ((strstr(label,"System Reserved") ) || // don't filter system reserved windows 7 boot parts␊ |
␉␉␉␉␉␉ fileExists((WinPath="/Volumes/" + DiskLabel + "/Windows/system.ini")))␊ |
␉␉␉␉␉found=true;␊ |
␉␉␉␉else if (strstr(fsType,"Linux") && !strstr(fsType, "Linux_Swap"))␊ |
␉␉␉␉else if ((strstr(fsType,"Linux") ) && !strstr(fsType, "Linux_Swap"))␊ |
␉␉␉␉␉found=true; // Added Linux case␊ |
␉␉␉␉if (found)␊ |
␉␉␉␉{ //check if one of them exists␊ |