From 094f791400b69efa4e1f7b16146c88cf6f077779 Mon Sep 17 00:00:00 2001 From: Klaas Freitag Date: Fri, 17 Aug 2012 17:55:15 +0300 Subject: [PATCH] Removed unused file temporarydir. --- src/CMakeLists.txt | 1 - src/mirall/temporarydir.cpp | 70 ------------------------------------- src/mirall/temporarydir.h | 37 -------------------- 3 files changed, 108 deletions(-) delete mode 100644 src/mirall/temporarydir.cpp delete mode 100644 src/mirall/temporarydir.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b5b1558fd..3977e0afd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -65,7 +65,6 @@ set(libsync_SRCS mirall/owncloudfolder.cpp mirall/csyncthread.cpp mirall/fileutils.cpp - mirall/temporarydir.cpp mirall/theme.cpp mirall/owncloudtheme.cpp mirall/miralltheme.cpp diff --git a/src/mirall/temporarydir.cpp b/src/mirall/temporarydir.cpp deleted file mode 100644 index 07caef19d..000000000 --- a/src/mirall/temporarydir.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) by Duncan Mac-Vicar P. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - */ - -#include "mirall/temporarydir.h" -#include "mirall/fileutils.h" - -#include -#include -#include - -#include -#include -#include - -namespace Mirall -{ - -static const QString dirTemplate = QDir::tempPath() + "/mirall-XXXXXX"; - -/* - * This class creates a temporary directory as Qt 4.x does not provide an - * implementation yet. It will come with Qt5, don't forget to PORT - * - * This class is only used in the test suite of mirall. - * As the mkdtemp function is problematic on non linux platforms, I change - * the filename generation to something more predictable using the timestamp. - * - * Note: This is not allowed for cases where the dir name needs to be - * unpredictable for security reasons. - */ - -TemporaryDir::TemporaryDir() -{ -#ifdef Q_WS_WIN - QDateTime dt = QDateTime::currentDateTime(); - QString p( QDir::tempPath() + "/mirall-" + dt.toString( Qt::ISODate ) ); - QDir dir( p ); - if( dir.mkpath( p ) ) { - _path = p; - } -#else - char *buff = ::strdup(dirTemplate.toLocal8Bit().data()); - char *tmp = ::mkdtemp(buff); - _path = QString((const char *) tmp); - ::free(buff); -#endif -} - -TemporaryDir::~TemporaryDir() -{ - FileUtils::removeDir(_path); -} - -QString TemporaryDir::path() const -{ - return _path; -} - -} diff --git a/src/mirall/temporarydir.h b/src/mirall/temporarydir.h deleted file mode 100644 index ee878409d..000000000 --- a/src/mirall/temporarydir.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) by Duncan Mac-Vicar P. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - */ - -#ifndef MIRALL_TEMPORARYDIR_H -#define MIRALL_TEMPORARYDIR_H - -#include - -namespace Mirall -{ - -class TemporaryDir -{ -public: - TemporaryDir(); - ~TemporaryDir(); - - QString path() const; - -private: - QString _path; -}; - -} - -#endif