How to check if a file exists with the QT Installer Framework?
Unsolved
General and Desktop
-
wrote on 8 Sept 2020, 03:28 last edited by narae 9 Aug 2020, 03:33
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?
-
wrote on 8 Jan 2021, 16:52 last edited by
You can try use
var files = QDesktopServices.findFiles("@InstallerDirPath@", "README2.txt");