Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

check folder exist and create folder in .pro file

Tags:

qt

qmake

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

so i used the following command in .pro file

 DESTDIR_WIN_CELLTWEAK = $${CORE_API_PATH}/Include/spgc/
    DESTDIR_WIN_CELLTWEAK ~= s,/,\\,g
    QMAKE_POST_LINK += $$quote(mkdir $${DESTDIR_WIN_CELLTWEAK} $$escape_expand(\n\t))
    for(FILE,EXPORTED_HEADERS_WIN){
                QMAKE_POST_LINK +=$$quote(cmd /c copy /y $${FILE} $${DESTDIR_WIN_CELLTWEAK}&$$escape_expand(\n\t))
    }

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

!exists($${DESTDIR_WIN_CELLTWEAK})
    {
        $$quote($${DESTDIR_WIN_CELLTWEAK})
        QMAKE_POST_LINK += $$quote(mkdir $${DESTDIR_WIN_CELLTWEAK} $$escape_expand(\n\t))
    }

but even if the folder present , !exists() function been called and creating the folder.

like image 464
Wagmare Avatar asked May 24 '17 07:05

Wagmare


1 Answers

this is how i resolved it

exists($$DESTDIR_WIN_CELLTWEAK) {
        message("existing")
    } else {
            QMAKE_POST_LINK += $$quote(mkdir $${DESTDIR_WIN_CELLTWEAK} $$escape_expand(\n\t))
    }

i added if with empty and in else created the directory

like image 79
Wagmare Avatar answered Nov 15 '22 05:11

Wagmare