diff --git a/src/QGCApplication.cc b/src/QGCApplication.cc index d735440668c5215dbffd406a223457b4d644b0ab..2617fbea545514679e24acf7a573c8eb91d027b8 100644 --- a/src/QGCApplication.cc +++ b/src/QGCApplication.cc @@ -196,39 +196,41 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting) #ifdef Q_OS_LINUX #ifndef __mobile__ - if (getuid() == 0) { - QMessageBox msgBox; - msgBox.setInformativeText("You are runnning QGroundControl as root. " - "You should not do this since it will cause other issues with QGroundControl. " - "QGroundControl will now exit. " - "If you are having serial port issues on Ubuntu, execute the following commands to fix most issues:\n" - "sudo usermod -a -G dialout $USER\n" - "sudo apt-get remove modemmanager"); - msgBox.setStandardButtons(QMessageBox::Ok); - msgBox.setDefaultButton(QMessageBox::Ok); - msgBox.exec(); - _exit(0); - } + if (!_runningUnitTests) { + if (getuid() == 0) { + QMessageBox msgBox; + msgBox.setInformativeText("You are runnning QGroundControl as root. " + "You should not do this since it will cause other issues with QGroundControl. " + "QGroundControl will now exit. " + "If you are having serial port issues on Ubuntu, execute the following commands to fix most issues:\n" + "sudo usermod -a -G dialout $USER\n" + "sudo apt-get remove modemmanager"); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.setDefaultButton(QMessageBox::Ok); + msgBox.exec(); + _exit(0); + } - // Determine if we have the correct permissions to access USB serial devices - QFile permFile("/etc/group"); - if(permFile.open(QIODevice::ReadOnly)) { - while(!permFile.atEnd()) { - QString line = permFile.readLine(); - if (line.contains("dialout") && !line.contains(getenv("USER"))) { - QMessageBox msgBox; - msgBox.setInformativeText("The current user does not have the correct permissions to access serial devices. " - "You should also remove modemmanager since it also interferes. " - "If you are using Ubuntu, execute the following commands to fix these issues:\n" - "sudo usermod -a -G dialout $USER\n" - "sudo apt-get remove modemmanager"); - msgBox.setStandardButtons(QMessageBox::Ok); - msgBox.setDefaultButton(QMessageBox::Ok); - msgBox.exec(); - break; + // Determine if we have the correct permissions to access USB serial devices + QFile permFile("/etc/group"); + if(permFile.open(QIODevice::ReadOnly)) { + while(!permFile.atEnd()) { + QString line = permFile.readLine(); + if (line.contains("dialout") && !line.contains(getenv("USER"))) { + QMessageBox msgBox; + msgBox.setInformativeText("The current user does not have the correct permissions to access serial devices. " + "You should also remove modemmanager since it also interferes. " + "If you are using Ubuntu, execute the following commands to fix these issues:\n" + "sudo usermod -a -G dialout $USER\n" + "sudo apt-get remove modemmanager"); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.setDefaultButton(QMessageBox::Ok); + msgBox.exec(); + break; + } } + permFile.close(); } - permFile.close(); } #endif #endif