Changeset fa4f55f


Ignore:
Timestamp:
03/03/14 11:36:24 (8 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, releng/10.0.1, releng/10.0.2, releng/10.0.3, releng/10.1
Children:
7b1e4b6
Parents:
1b87cd2
Message:

Use ntfslabel instead of glabel for NTFS formatted devices when looking for a device label in the mounttray.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/pc-mounttray/devCheck.cpp

    re417b8a rfa4f55f  
     1 
    12#include <pcbsd-utils.h> 
    23#include "devCheck.h" 
     
    5455QString DevCheck::devLabel(QString node, QString filesystem){ 
    5556  QString dlabel; 
    56   QStringList glout = pcbsd::Utils::runShellCommand("glabel list"); 
    57   int index = glout.indexOf("Geom name: "+node); 
    58   while(index != -1){ 
    59     for(int i=index; i<glout.length(); i++){  
    60       if(glout[i].contains("Name: ")){ index = i; break;} //should only be 1 or 2 lines to find this 
    61     } 
    62     if(index == -1){ break; } //quick check to make sure we don't error out 
    63     QString path = glout[index].section("Name:",1,10,QString::SectionSkipEmpty).simplified();   
    64     int fschk = fsMatch.indexOf(filesystem); 
    65     if(fschk != -1){ 
    66       if(fsFilter[fschk] == path.section("/",0,0).simplified() ){ 
    67         //good label 
    68         dlabel = path.section("/",-1).simplified(); 
    69         break; 
    70       } 
    71     } 
    72     index = glout.indexOf("Geom name: "+node, index); //move to the next index if there is one 
    73   } 
    74   dlabel.replace("%20", " "); //quick check to make sure it does not have that special character 
     57  if(filesystem.toLower()=="ntfs"){ 
     58    //Use ntfslabel for ntfs filesystems 
     59    dlabel = pcbsd::Utils::runShellCommand("ntfslabel "+devDir.absoluteFilePath(node) ).join("").simplified(); 
     60  }else{ 
     61    //All other filesystems 
     62    QStringList glout = pcbsd::Utils::runShellCommand("glabel list"); 
     63    int index = glout.indexOf("Geom name: "+node); 
     64    while(index != -1){ 
     65      for(int i=index; i<glout.length(); i++){  
     66        if(glout[i].contains("Name: ")){ index = i; break;} //should only be 1 or 2 lines to find this 
     67      } 
     68      if(index == -1){ break; } //quick check to make sure we don't error out 
     69      QString path = glout[index].section("Name:",1,10,QString::SectionSkipEmpty).simplified();   
     70      int fschk = fsMatch.indexOf(filesystem); 
     71      if(fschk != -1){ 
     72        if(fsFilter[fschk] == path.section("/",0,0).simplified() ){ 
     73          //good label 
     74          dlabel = path.section("/",-1).simplified(); 
     75          break; 
     76        } 
     77      } 
     78      index = glout.indexOf("Geom name: "+node, index); //move to the next index if there is one 
     79    } 
     80    dlabel.replace("%20", " "); //quick check to make sure it does not have that special character 
     81  } 
    7582  return dlabel; 
    7683} 
     
    194201  QString glabel; 
    195202  //Don't use glabel for SATA devices right now because it is inconsistent 
    196   if(!isCD && filesys!="NTFS"){ glabel = devLabel(node, filesys); } 
     203  if(!isCD){ glabel = devLabel(node, filesys); } 
    197204  //Check to see if we have a label, otherwise assign one 
    198205  if( !glabel.isEmpty() ){ dlabel = glabel; hasLabel = TRUE; } //glabel 
Note: See TracChangeset for help on using the changeset viewer.