summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkh1 <karsten.heimrich@digia.com>2014-05-22 16:08:28 +0200
committerKarsten Heimrich <karsten.heimrich@digia.com>2014-05-22 16:13:21 +0200
commit8c9831108a2aa591908b9548dec911dbefa4fffb (patch)
tree094e2296fefd46cf0832dee6dedd30b8dde2914c
parent93408c8fb69175543390a5c9f98615216e6eb8fc (diff)
Revert "Use QTemporaryFile instead of some homebrew construction."
This reverts commit 23d0dc225dbe3f89d0411c0195d8bcd066c3bdc7. Thought the implementation looks right in the first place, it will fail if we are asking for a random name inside a directory where we do not have access rights. QTemporaryFile will not roundtrip to the admin server and therefor return an empty string. Change-Id: I0bd716b10e43242f5da5dd939b06213040256d67 Reviewed-by: Niels Weber <niels.weber@digia.com>
-rw-r--r--src/libs/kdtools/kdsavefile.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libs/kdtools/kdsavefile.cpp b/src/libs/kdtools/kdsavefile.cpp
index 8e2209604..da2d9db3a 100644
--- a/src/libs/kdtools/kdsavefile.cpp
+++ b/src/libs/kdtools/kdsavefile.cpp
@@ -174,10 +174,11 @@ static QFile *createFile(const QString &path, QIODevice::OpenMode m, QFile::Perm
*/
static QString generateTempFileName(const QString &path)
{
- QTemporaryFile tmpfile(path);
- tmpfile.open();
- const QString tmp = tmpfile.fileName();
- return tmp;
+ const QString tmp = path + QLatin1String("tmp.dsfdf.%1"); //TODO: use random suffix
+ int count = 1;
+ while (QFile::exists(tmp.arg(count)))
+ ++count;
+ return tmp.arg(count);
}
/*!