{␊ |
␉if (_fsType.find("Apple")!=std::string::npos ||␊ |
␉␉_fsType.find("HFS")!=std::string::npos)␊ |
␉␉return 0; // Windows␊ |
␉␉return 0; // Mac␊ |
␉else if (_fsType.find("Windows")!=std::string::npos ||␊ |
␉␉␉ _fsType.find("Microsoft")!=std::string::npos ||␊ |
␉␉␉ _fsType.find("NTFS")!=std::string::npos ||␊ |
␉␉␉ _fsType.find("FAT")!=std::string::npos)␊ |
␉␉return 1; // Windows␊ |
␉else if (_fsType.find("Linux")!=std::string::npos)␊ |
␉␉return 2; // Unknown␊ |
␉␉return 2; // Linux␊ |
␉return 10; //Unknown␊ |
␉␊ |
}␊ |
|
// for the debug to be accurate you need to alias (ln -s ...) the user to debug with your real disks␊ |
#define DEBUG_DISKUTIL 0␊ |
␊ |
␊ |
//----------------------------------------------------------------␊ |
const std::vector<PartitionInfo>& ␊ |
PartitionExtractor::extractPartitions(const char* szHide, const char* szRenamed)␊ |
|
␉␉␉␊ |
␉␉␉*q='\0';␊ |
␉␉␉part = line[skipwhite]-'0';␊ |
␉␉␉partInfo.fsType(fsType);␊ |
␉␉␉partInfo.disk(disk);␊ |
␉␉␉partInfo.partition(part);␊ |
␉␉␉partInfo.label(checkForRename(label, partInfo.toHdStr().c_str()));␊ |
␉␉␉size_t len = partInfo.label().length();␊ |
␉␉␉if(len==0){␊ |
␉␉␉␉strncpy(label, "Untitled", sizeof(label));␊ |
␉␉␉␉partInfo.label(label);␊ |
␉␉␉}␊ |
␉␉␉␊ |
␉␉␉std::replace(fsType, fsType+strlen(fsType), '_', ' ' );␊ |
␉␉␉partInfo.fsType(fsType);␊ |
␉␉␉␊ |
␉␉␉std::string diskLabel(trim(label)); ␊ |
␉␉␉␉␊ |
␉␉␉// filter useless partitions:␊ |
␉␉␉if (partInfo.clabel()[len-1] !='*' && ␊ |
␉␉␉␉partInfo.label()!="EFI" && ␊ |
␉␉␉␉partInfo.fsType()!="EFI" &&␊ |
␉␉␉␉partInfo.fsType()!="Apple_partition_scheme" &&␊ |
␉␉␉␉partInfo.fsType()!="Apple_partition_map" &&␊ |
␉␉␉␉partInfo.fsType()!="Apple_Free" ␊ |
␉␉␉␉)␊ |
␉␉␉{␊ |
␉␉␉␉if (partInfo.fsType()=="Apple_HFS") partInfo.fsType("Apple HFS");␊ |
␉␉␉␉std::string diskLabel(trim(label)); ␊ |
␉␉␉␉bool found=false;␊ |
␉␉␉bool found=false;␊ |
␉␉␉␉// 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") || ␊ |
␉␉␉if (␊ |
␉␉␉␉␉fileExists("/Volumes/" + diskLabel + "/System/Library/Extensions") ||␊ |
␉␉␉␉␉fileExists("/Volumes/" + diskLabel + "/ntldr") ||␊ |
␉␉␉␉␉fileExists("/Volumes/" + diskLabel + "/bootmgr") ||␊ |
␉␉␉␉␉fileExists("/Volumes/" + diskLabel + "/Boot") ||␊ |
␉␉␉␉␉fileExists("/Volumes/" + diskLabel + "/boot/bcd") ||␊ |
␉␉␉␉␉fileExists("/Volumes/" + diskLabel + "/pagefile.sys") ||␊ |
␉␉␉␉␉fileExists("/Volumes/" + diskLabel + "/hiberfil.sys")␊ |
␉␉␉␉␉)␊ |
␉␉␉␉␉found=true;␊ |
␉␉␉␉else if ((strstr(fsType,"Linux") ) && !strstr(fsType, "Linux_Swap"))␊ |
␉␉␉␉␉found=true; // Added Linux case␊ |
␉␉␉␉if (found)␊ |
␉␉␉␉{ //check if one of them exists␊ |
␉␉␉␉)␊ |
␉␉␉␉found=true;␊ |
␉␉␉else if ((strstr(fsType,"Linux") ) && !strstr(fsType, "Linux Swap"))␊ |
␉␉␉␉found=true; // Added Linux case␊ |
␉␉␉␉␊ |
␉␉␉if (found) //check if one of them exists␊ |
␉␉␉␉{␊ |
␉␉␉␉␉if (partInfo.label().size()==0) partInfo.label("Untitled");␊ |
␉␉␉␉␉if(_hiddenParts.length()==0 || ␊ |
␉␉␉␉␉ _hiddenParts.find(partInfo.toHdStr()) == std::string::npos)␊ |
␉␉␉␉␉␉_partList.push_back(partInfo);␊ |
␉␉␉␉}␊ |
␉␉␉}␊ |
␉␉␉␊ |
␉␉}␊ |
␉}␊ |
␉close();␊ |
|
* Get the index in the internal partlist of the hd(n,m) partition specified by the input string␊ |
* return -1 if no match, >=0 if a match happens␊ |
*/␊ |
␊ |
int PartitionExtractor::getIndexFromHdStringSpec(const char* inHDStr)␊ |
{␉␊ |
␉PartitionInfo info;␊ |