Please nominate your Qt Champions for 2021!

SetCurrentWorkingDirectory how to set it

  • Banned

    I want to set my current working directory as something else..Not from where I launched the application. From where I am loading my model through file dialog that should be my current working directory. How can I set it. Please advice.

  • Hello appollosputnik
    Usually you do not do such a thing with QDir, but if you are to change current working directory, I don't think you can do that from within of an application.

    The only way I know to do this is to change the working directory in the IDE (visual studio: Project Properties -> Configuration Properties -> Debugging -> Working Directory)

    You may also want to look at following QCoreApplication methods:
    @QString applicationDirPath ()
    QString applicationFilePath ()@


    Ok, there is a much simpler way. Use following method to set current working dir:
    @bool QDir::setCurrent ( const QString & path ) [static]@

Log in to reply