Skip to content

Commit eaadef3

Browse files
committed
ENH: Add directory existence and readability checks for include paths in generator
Introduce `dirExistsAndReadable` utility to validate include directories before use and enhance debugging output for include resolution in the generator.
1 parent fad2ce8 commit eaadef3

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

generator/main.cpp

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ static bool fileExistsAndReadable(const QString& filePath) {
6666
(QFile(filePath).permissions() & QFileDevice::ReadUser);
6767
}
6868

69+
static bool dirExistsAndReadable(const QString& dirPath) {
70+
QDir dir(dirPath);
71+
return dir.exists() && dir.isReadable();
72+
}
73+
6974
void displayHelp(GeneratorSet *generatorSet);
7075

7176

@@ -143,7 +148,21 @@ namespace
143148
includes << (qtIncludePrefix + "/QtOpenGL");
144149
includes << qtIncludePrefix;
145150
}
146-
return includes;
151+
QStringList found_includes;
152+
for (auto &candidate_include : includes)
153+
{
154+
if (dirExistsAndReadable(candidate_include))
155+
{
156+
printf("INFO -- FOUND INCLUDE: %s\n", qPrintable(candidate_include));
157+
found_includes << candidate_include;
158+
}
159+
else
160+
{
161+
printf("INFO -- NOT FOUND INCLUDE: %s\n", qPrintable(candidate_include));
162+
}
163+
}
164+
165+
return found_includes;
147166
}
148167

149168
bool
@@ -457,6 +476,7 @@ void displayHelp(GeneratorSet* generatorSet) {
457476
" --no-suppress-warnings \n"
458477
" --output-directory=[dir] \n"
459478
" --include-paths=<path>[%c<path>%c...] \n"
479+
" --qt-include-prefix=<path> \n"
460480
" --qt-version=x.y.z \n"
461481
" --print-stdout \n",
462482
path_splitter, path_splitter);

0 commit comments

Comments
 (0)