diff options
author | Petr Mrázek <peterix@gmail.com> | 2016-11-17 04:09:24 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2016-11-17 04:09:24 +0100 |
commit | 9b4198663463ce584fbd4f78adff29edc2bbc51c (patch) | |
tree | aa2efabf194ef68bc454582ee497acc38bbb1dc9 /api/logic/FileSystem.cpp | |
parent | b09fad9cbf1f297ba2abb852d683f9fe5cfb9b3b (diff) | |
download | MultiMC-9b4198663463ce584fbd4f78adff29edc2bbc51c.tar MultiMC-9b4198663463ce584fbd4f78adff29edc2bbc51c.tar.gz MultiMC-9b4198663463ce584fbd4f78adff29edc2bbc51c.tar.lz MultiMC-9b4198663463ce584fbd4f78adff29edc2bbc51c.tar.xz MultiMC-9b4198663463ce584fbd4f78adff29edc2bbc51c.zip |
GH-347 update timestamps of added mods
Diffstat (limited to 'api/logic/FileSystem.cpp')
-rw-r--r-- | api/logic/FileSystem.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/api/logic/FileSystem.cpp b/api/logic/FileSystem.cpp index 7805a78b..67bafd28 100644 --- a/api/logic/FileSystem.cpp +++ b/api/logic/FileSystem.cpp @@ -60,6 +60,25 @@ QByteArray read(const QString &filename) return data; } +bool updateTimestamp(const QString& filename) +{ + QFile file(filename); + if (!file.exists()) + { + return false; + } + if (!file.open(QIODevice::ReadWrite)) + { + return false; + } + const quint64 size = file.size(); + file.seek(size); + file.write( QByteArray(1, '0') ); + file.resize(size); + return true; + +} + bool ensureFilePathExists(QString filenamepath) { QFileInfo a(filenamepath); |