[SOLVED] Copy a directory recursively by qmake.



  • I want to copy a directory that has many subdirectories and javascript and css files. it works as expected on Linux. Unfortunatly my code doesn't work on windows 7 when I compile.

    Related code in my pro file

    tdestdir = $$clean_path($$PWD/../installer/ClientInstaller/packages/TemasClient/data)
        DESTDIR = $$tdestdir
        RESDIR = $$clean_path($$PWD/../resources/share)
    
        resourcedata.commands = $(COPY_DIR) \"$$RESDIR\" \"$$DESTDIR\"
        first.depends = $(first) resourcedata
        export(first.depends)
        export(resourcedata.commands)
        QMAKE_EXTRA_TARGETS += first resourcedata
    

    I got compile error "Invalid Parameter". But I test related command in windows console, it works.

    xcopy /s /q /y /i "C:/Qt/projects/temasframework_clients/temasframework_clients/resources/share" "C:/Qt/projects/temasframework_clients/temasframework_clients/installer/ClientInstaller/packages/TemasClient/data"

    What is the problem? Thank you for advance.



  • I found the solution. Problem is related to windows path separator. It should be backslash. So I wrote and added these lines of code.

        tdestdir = $$clean_path($$PWD/../installer/ClientInstaller/packages/TemasClient/data)
        DESTDIR = $$tdestdir
        tdestdir = $$shell_quote($$tdestdir)
        RESDIR = $$shell_quote($$clean_path($$PWD/../resources/share))
    
    win32{
            tdestdir = $$system_path($$tdestdir)
            RESDIR = $$system_path($$RESDIR)
    }
    
        resourcedata.commands = $(COPY_DIR) $$RESDIR $$tdestdir
        first.depends = $(first) resourcedata
        export(first.depends)
        export(resourcedata.commands)
        QMAKE_EXTRA_TARGETS += first resourcedata
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.