Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to check if a file exists with the QT Installer Framework?
Forum Update on Monday, May 27th 2025

How to check if a file exists with the QT Installer Framework?

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 1.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    narae
    wrote on 8 Sept 2020, 03:28 last edited by narae 9 Aug 2020, 03:33
    #1

    I want to check file exist.

    I created folder: %temp%\test (C:\Users\me\AppData\Local\Temp\test)
    I copied README2.txt to the folder.

    And if there the file in the folder, I want to copy them to TargetDir.

    So I did it like the code below.

    if(installer.fileExists("@InstallerDirPath@/README2.txt")){
                console.log("Find File");
                component.addOperation("Copy", "@InstallerDirPath@/README2.txt", "@TargetDir@/README2.txt");
    }
    else
                console.log("Can't Find File");
    

    InstallerDirPath: The directory that contains the installer application executable.

    However, even if there is a README2.txt file in the folder, the file cannot be found.

    How can I check if the file exists and copy the file?

    1 Reply Last reply
    0
    • V Offline
      V Offline
      Vitali
      wrote on 8 Jan 2021, 16:52 last edited by
      #2

      You can try use

      var files = QDesktopServices.findFiles("@InstallerDirPath@", "README2.txt");
      
      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved