Logo Search packages:      
Sourcecode: q4wine version File versions  Download package

QString corelib::getWhichOut ( const QString  fileName,
bool  showErr = TRUE 
)

This function get cdrom devices from /etc/fstab file.

Returns:
Return an list of cdrom devices.
This function get output from which shell built-in command.
Returns:
Return the full path of binary.

Definition at line 497 of file q4wine-lib.cpp.

References showError().

Referenced by getMountImageString(), getMountString(), getUmountString(), and mountImage().

                                                                {
      /*
   * Getting 'which' output;
   */

    if  (fileName=="mdconfig"){
            if (!mdconfig.isEmpty())
                  return mdconfig;
      } else if  (fuseiso=="fuseiso"){
            if (!fuseiso.isEmpty())
                  return fuseiso;
      } else if  (fileName=="fusermount"){
            if (!fusermount.isEmpty())
                  return fusermount;
      } else if  (fileName=="ln"){
            if (!ln.isEmpty())
                  return ln;
      } else if  (fileName=="rm"){
            if (!rm.isEmpty())
                  return rm;
      } else if  (fileName=="sh"){
            if (!sh.isEmpty())
                  return sh;
      }

      QProcess proc;
      QStringList args;

      args<<fileName;

      proc.setWorkingDirectory (QDir::homePath());
      proc.start("which", args, QIODevice::ReadOnly);
      proc.waitForFinished();

      QString string = proc.readAllStandardOutput();

      if (!string.isEmpty()){
        if (fileName=="mdconfig"){
                  mdconfig=string.trimmed();
            } else if (fileName=="fuseiso"){
                  fuseiso=string.trimmed();
            } else if (fileName=="fusermount"){
                  fusermount=string.trimmed();
            } else if (fileName=="ln"){
                  ln=string.trimmed();
            } else if (fileName=="rm"){
                  rm=string.trimmed();
            } else if (fileName=="sh"){
                  sh=string.trimmed();
            }

            return string.trimmed();
      } else {
            if (showErr)
                  this->showError(QObject::tr("Can't find or execute '%1' binary. Make shure this binary is available by search PATH variable and see also INSTALL file for application depends.").arg(fileName));
      }

      return "";
}


Generated by  Doxygen 1.6.0   Back to index