I have an issue with ExtractTemporaryFiles
while extracting *.sql
files
I don't always have SQL scripts inside [Files]
section to extract as mentioned below. My problem is ExtractTemporaryFiles('*.sql')
raises an exception if no sql files are included with the installation.
Internal error: ExtractTemporaryFiles: No files matching "*.sql" found.
I can use try:except
or another ugly way like, including a dummy.sql
with the installation always. So I can make sure ExtractTemporaryFiles
has a file to extract it always.
But I want to know What is the best way of avoiding exception in this case?
[Files]
Source: "Input\SQLSCRIPTS\*"; DestDir: "SQLSCRIPTS"; Flags: ignoreversion dontcopy skipifsourcedoesntexist
You can use a preprocessor to conditionally skip the ExtractTemporaryFiles
call:
#if FindFirst("Input\SQLSCRIPTS\*.sql", 0)
ExtractTemporaryFiles('*.sql');
#endif