Results 1 to 4 of 4

Thread: Newbie asks: How to use working directory set in QtCreator

  1. #1
    Join Date
    Oct 2009
    Posts
    5
    Platforms
    Windows

    Default Newbie asks: How to use working directory set in QtCreator

    Hi!

    I'm very new to QT and i have a question. I created a project and set the "Working directory" for debug via project settings to a path that is not the build-directory.

    Is it possible to execute the code that follows so that it uses the "working directory":

    QString dir;
    QString styleSheet;
    QString filename;
    QFile styleFile;

    dir = qApp->applicationDirPath();


    qApp->applicationDirPath(); should point to my working directory. Is it somehow possible?

    How would you deal with that? Use a build-dir and for execution a working directory?


    Thank you very much!

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Newbie asks: How to use working directory set in QtCreator

    You can't alter the applications dir path. See QDir::setCurrent() instead. (Also note your wiki [WIKI]Current working directory[/WIKI])

  3. #3
    Join Date
    Oct 2009
    Posts
    5
    Platforms
    Windows

    Default Re: Newbie asks: How to use working directory set in QtCreator

    OK, thank you! So...i have to find out if in debug-build and set the dir manually with

    #ifdef Q_DEBUG
    exedir = "C:/Mydir";
    #end
    #else
    exedir = App->applicationDirPath();
    #end

    Or is their a way to set the ouput of my exe only (no other files, exe only) to a specific directory?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Newbie asks: How to use working directory set in QtCreator

    What do you mean "output of my exe"? You mean the directory where the application should be built? That's controlled by the DESTDIR qmake variable.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. QtCreator 2.0 crashes application working in QtCreator 1.3
    By been_1990 in forum Qt Programming
    Replies: 2
    Last Post: 21st September 2010, 13:58
  2. QProcess - Working directory problem
    By jomarin in forum Qt Programming
    Replies: 4
    Last Post: 27th November 2008, 17:26
  3. Set Working Directory in VS
    By Lele in forum Qt Programming
    Replies: 1
    Last Post: 20th February 2008, 18:03
  4. Don't want QTextBrowser to look in working directory
    By magland in forum Qt Programming
    Replies: 1
    Last Post: 21st October 2007, 00:14
  5. QT Service and working directory
    By Lele in forum Qt Programming
    Replies: 1
    Last Post: 23rd January 2006, 12:46

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.