Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved QProcess QDir::currentPath() error

    General and Desktop
    2
    2
    313
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • sonichy
      sonichy last edited by

      Program A:
      QProcess *proc = new QProcess;
      proc->start(pathb);
      
      Program B:
      QDir::currentPath()
      

      QDir::currentPath() in program B,changed to QDir::currentPath() of A, cause config file read and write error.

      https://github.com/sonichy

      jsulm 1 Reply Last reply Reply Quote 0
      • jsulm
        jsulm Lifetime Qt Champion @sonichy last edited by

        @sonichy Use http://doc.qt.io/qt-5/qprocess.html#setWorkingDirectory
        As explained there:
        "Sets the working directory to dir. QProcess will start the process in this directory. The default behavior is to start the process in the working directory of the calling process."

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 3
        • First post
          Last post