diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2023-07-12 10:31:04 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2023-07-12 17:48:48 +0200 |
commit | 3ba3f322b6b1781cfc1a64be8240b1ae74c36840 (patch) | |
tree | fd58a58d0487f73be9dcbd9071009d6c72b5c08d /src/tools/moc/main.cpp | |
parent | dd1b7b5539d6aecdd5f8342ef0fa260e40f5c483 (diff) |
moc: Print sterror(errno) when moc can't write the output file
Also prepend a "Error:" label to all strrerror handling locations,
to make it clear where the error starts.
Pick-to: 6.2 6.5 6.6
Task-number: QTBUG-101926
Change-Id: I1a781b4c5716636eff4d47a6c8554dcbd51d2697
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/tools/moc/main.cpp')
-rw-r--r-- | src/tools/moc/main.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp index 2f0d11a056..3df832cc2e 100644 --- a/src/tools/moc/main.cpp +++ b/src/tools/moc/main.cpp @@ -536,7 +536,10 @@ int runMoc(int argc, char **argv) if (!out) #endif { - fprintf(stderr, "moc: Cannot create %s\n", QFile::encodeName(output).constData()); + const auto fopen_errno = errno; + fprintf(stderr, "moc: Cannot create %s. Error: %s\n", + QFile::encodeName(output).constData(), + strerror(fopen_errno)); return 1; } @@ -551,7 +554,7 @@ int runMoc(int argc, char **argv) #endif { const auto fopen_errno = errno; - fprintf(stderr, "moc: Cannot create JSON output file %s. %s\n", + fprintf(stderr, "moc: Cannot create JSON output file %s. Error: %s\n", QFile::encodeName(jsonOutputFileName).constData(), strerror(fopen_errno)); } @@ -601,7 +604,7 @@ int runMoc(int argc, char **argv) #endif { const auto fopen_errno = errno; - fprintf(stderr, "moc: Cannot create dep output file '%s'. %s\n", + fprintf(stderr, "moc: Cannot create dep output file '%s'. Error: %s\n", QFile::encodeName(depOutputFileName).constData(), strerror(fopen_errno)); } |