diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-10-19 13:10:18 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-10-19 17:22:51 +0000 |
| commit | c6fb7198d726d61d90a702aa66c89765c3f19e79 (patch) | |
| tree | a6340d1cf46c03d1b74ed11f522a1f6034f15fc1 /sources/shiboken2/ApiExtractor/fileout.cpp | |
| parent | ee4a3c9259258007e540eac505cdc9b5d38fdaac (diff) | |
shiboken: Use class FileOut for the module source file as well
Ensure the diff/dry-run options work for this file as well. Move the
touchFile() utility around and adapt the verifyDirectoryFor() helper
to take a string.
Task-number: PYSIDE-834
Change-Id: Ic34b5f8eff304d9de85f60082f582f0537805cd4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken2/ApiExtractor/fileout.cpp')
| -rw-r--r-- | sources/shiboken2/ApiExtractor/fileout.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/sources/shiboken2/ApiExtractor/fileout.cpp b/sources/shiboken2/ApiExtractor/fileout.cpp index 475eb386b..10a8f6be8 100644 --- a/sources/shiboken2/ApiExtractor/fileout.cpp +++ b/sources/shiboken2/ApiExtractor/fileout.cpp @@ -33,6 +33,7 @@ #include <QtCore/QTextCodec> #include <QtCore/QFileInfo> #include <QtCore/QDir> +#include <QtCore/QDebug> #include <cstdio> @@ -231,3 +232,18 @@ FileOut::State FileOut::done(QString *errorMessage) return Success; } + +void FileOut::touchFile(const QString &filePath) +{ + QFile toucher(filePath); + qint64 size = toucher.size(); + if (!toucher.open(QIODevice::ReadWrite)) { + qCWarning(lcShiboken).noquote().nospace() + << QStringLiteral("Failed to touch file '%1'") + .arg(QDir::toNativeSeparators(filePath)); + return; + } + toucher.resize(size+1); + toucher.resize(size); + toucher.close(); +} |
