QProcess::startDetached deprecated in 4.6.3?



  • I'm writing a piece of code to download and launch a particular file outside of my application and have been running into an issue with Qt 4.6.3. I have the code tested and working on my local Qt 4.8.1 and 4.8.4 builds but when I have built the executables using 4.6.3 I do not see the same behavior of the QProcess::startDetached launching. Code snippet below, any tips?

    @QStringList options;
    QProcess *installer = new QProcess(this);
    #ifdef Q_WS_MACX
    QProcess sh;
    sh.start("tar -xvf " + filename);
    sh.waitForFinished();
    QByteArray output= sh.readAll();
    sh.close();
    filename = "file.app";
    QFileInfo *path2 = new QFileInfo(filename);
    QString filepath = path2->absoluteFilePath() + "/Contents/MacOS/osx-intel";
    installer->startDetached(filepath, options);
    #endif@


  • Lifetime Qt Champion

    What should happen and what is happening ?



  • I appreciate the quick response, the behavior that I am seeing is when executing the code in 4.8.4 the process starts the file.app/Contents/MacOS/osx-intel and continues on it's way. When I build on qt 4.6.3 (external build machine) the code downloads the file into the tar.gz format and does not execute the untar step at line 5. This whole code snippet is trying to deal with the mac .app format for an application. Note: seeing same behavior with linux build with the following code:
    @#ifdef Q_OS_LINUX
    QFile launch(filename); launch.setPermissions(QFile::ReadOwner|QFile::WriteOwner|QFile::ExeOwner|QFile::ReadGroup|QFile::WriteGroup|QFile::ExeGroup|QFile::ReadOther|QFile::WriteOther|QFile::ExeOther);
    QFileInfo *path = new QFileInfo(filename);
    installer->startDetached(path->absoluteFilePath(), options);
    if(installer->startDetached(filename))
    reject();
    #endif@


  • Lifetime Qt Champion

    Did you check the output standard out/error from QProcess to see if it complained about something ? i.e. invalid file location etc...


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.