Results 1 to 2 of 2

Thread: check folder exist and create folder in .pro file

  1. #1
    Join Date
    Sep 2008
    Thanked 42 Times in 41 Posts
    Qt products
    Unix/X11 Windows

    Default check folder exist and create folder in .pro file

    I have to create a folder in my target path and copy the header files.

    so i used the following command in .pro file

    Qt Code:
    1. DESTDIR_WIN_CELLTWEAK = $${CORE_API_PATH}/Include/spgc/
    2. DESTDIR_WIN_CELLTWEAK ~= s,/,\\,g
    3. QMAKE_POST_LINK += $$quote(mkdir $${DESTDIR_WIN_CELLTWEAK} $$escape_expand(\n\t))
    5. QMAKE_POST_LINK +=$$quote(cmd /c copy /y $${FILE} $${DESTDIR_WIN_CELLTWEAK}&$$escape_expand(\n\t))
    6. }
    To copy to clipboard, switch view to plain text mode 
    it is creating the folder in first time. but on building second i have to avoid creation of spgc folder (as already exist) .

    also qt build throws error if spgc folder already exist.

    i tried

    Qt Code:
    1. !exists($${DESTDIR_WIN_CELLTWEAK})
    2. {
    3. $$quote($${DESTDIR_WIN_CELLTWEAK})
    4. QMAKE_POST_LINK += $$quote(mkdir $${DESTDIR_WIN_CELLTWEAK} $$escape_expand(\n\t))
    5. }
    To copy to clipboard, switch view to plain text mode 
    but even if the folder present , !exists() function been called and creating the folder.
    "Behind every great fortune lies a crime" - Balzac

  2. #2
    Join Date
    Jan 2006
    Warsaw, Poland
    Thanked 5,013 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits

    Default Re: check folder exist and create folder in .pro file

    Doesn't windows have an equivalent of "mkdir -p" in UNIX systems?
    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. Qt 5.1 : Want to put qt.conf file in different folder that application exe folder
    By Rajesh.Rathod in forum Installation and Deployment
    Replies: 1
    Last Post: 20th July 2014, 15:48
  2. Replies: 3
    Last Post: 23rd May 2013, 09:20
  3. Replies: 0
    Last Post: 13th October 2010, 05:27
  4. Can't create folder if file with same name exists
    By Barry79 in forum Qt Programming
    Replies: 1
    Last Post: 6th May 2009, 17:33
  5. Replies: 3
    Last Post: 11th September 2008, 21:08


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.