Здравствуйте
Есть код:
QProcess proc;
QStringList env = proc.systemEnvironment();
qDebug() << env;
qDebug() << env.indexOf(QRegExp("HOME=*"));
Результат работы кода:
+9.215: DBG: ("QT_QPA_PLATFORM=photon:no_offscreen", "_=/tmp/poSKP/bin/poSKP", "LD_LIBRARY_PATH=:/opt/qt571/x86/lib:/opt/mesa3d/x86/lib:/opt/gcc/lib", "SSH_CONNECTION=192.168.180.1 57359 192.168.180.136 22", "PATH=/sbin:/usr/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/bin:/opt/sbin:/usr/qnx650/host/qnx6/x86/usr/bin:/usr/qnx650/host/qnx6/x86/usr/sbin:/usr/qnx650/host/qnx6/x86/sbin:/usr/qnx650/host/qnx6/x86/bin:/usr/qnx650/host/qnx6/x86/usr/photon/appbuilder", "SHELL=/bin/sh", "MAKEFLAGS=-I/usr/qnx650/target/qnx6/usr/include", "QNX_HELP_HOME_PAGE=/usr/qnx650/target/qnx6/usr/help/product/momentics/bookset.html", "HOSTNAME=modelBM", "USER=root", "TMPDIR=/tmp", "MAIL=/var/spool/mail/root", "PROCESSOR=x86", "HOME=/root", "SSH_CLIENT=192.168.180.1 57359 22", "QNX_HOST=/usr/qnx650/host/qnx6/x86", "QNX_TARGET=/usr/qnx650/target/qnx6", "QNX_HELP_PATH=/usr/qnx650/target/qnx6/usr/help/product", "QNX_CONFIGURATION=/etc/qnx", "LOGNAME=root", "SYSNAME=nto", "PHOTON=/dev/photon")
+9.216: DBG: -1
Почему не нашлась строка "HOME=/root" (присутствует в выводе)?
OC QNX 6.5.0, Qt 5.7.1