Browse Source

Merge pull request #5987 from Chocobo1/temp_dir

Put temp files in .qBittorrent directory
adaptive-webui-19844
sledgehammer999 8 years ago committed by GitHub
parent
commit
ba03fb30f3
  1. 1
      src/app/application.cpp
  2. 1
      src/base/http/requestparser.cpp
  3. 2
      src/base/net/downloadhandler.cpp
  4. 7
      src/base/utils/fs.cpp
  5. 1
      src/base/utils/fs.h
  6. 1
      src/gui/search/pluginselectdlg.cpp
  7. 1
      src/gui/search/searchwidget.cpp
  8. 3
      src/webui/abstractwebapplication.cpp

1
src/app/application.cpp

@ -629,6 +629,7 @@ void Application::cleanup()
delete m_fileLogger; delete m_fileLogger;
Logger::freeInstance(); Logger::freeInstance();
IconProvider::freeInstance(); IconProvider::freeInstance();
Utils::Fs::removeDirRecursive(Utils::Fs::tempPath());
#ifndef DISABLE_GUI #ifndef DISABLE_GUI
#ifdef Q_OS_WIN #ifdef Q_OS_WIN

1
src/base/http/requestparser.cpp

@ -35,7 +35,6 @@
#include <QUrlQuery> #include <QUrlQuery>
#endif #endif
#include <QDir> #include <QDir>
#include <QTemporaryFile>
#include <QDebug> #include <QDebug>
#include "requestparser.h" #include "requestparser.h"

2
src/base/net/downloadhandler.cpp

@ -142,7 +142,7 @@ void DownloadHandler::init()
bool DownloadHandler::saveToFile(const QByteArray &replyData, QString &filePath) bool DownloadHandler::saveToFile(const QByteArray &replyData, QString &filePath)
{ {
QTemporaryFile *tmpfile = new QTemporaryFile; QTemporaryFile *tmpfile = new QTemporaryFile(Utils::Fs::tempPath() + "XXXXXX");
if (!tmpfile->open()) { if (!tmpfile->open()) {
delete tmpfile; delete tmpfile;
return false; return false;

7
src/base/utils/fs.cpp

@ -491,3 +491,10 @@ QString Utils::Fs::cacheLocation()
locationDir.mkpath(locationDir.absolutePath()); locationDir.mkpath(locationDir.absolutePath());
return location; return location;
} }
QString Utils::Fs::tempPath()
{
static const QString path = QDir::tempPath() + "/.qBittorrent/";
QDir().mkdir(path);
return path;
}

1
src/base/utils/fs.h

@ -67,6 +67,7 @@ namespace Utils
/* End of Qt4 code */ /* End of Qt4 code */
QString cacheLocation(); QString cacheLocation();
QString tempPath();
} }
} }

1
src/gui/search/pluginselectdlg.cpp

@ -34,7 +34,6 @@
#include <QMessageBox> #include <QMessageBox>
#include <QFileDialog> #include <QFileDialog>
#include <QDropEvent> #include <QDropEvent>
#include <QTemporaryFile>
#include <QMimeData> #include <QMimeData>
#include <QClipboard> #include <QClipboard>
#ifdef QBT_USES_QT5 #ifdef QBT_USES_QT5

1
src/gui/search/searchwidget.cpp

@ -31,7 +31,6 @@
#include <QHeaderView> #include <QHeaderView>
#include <QMessageBox> #include <QMessageBox>
#include <QTemporaryFile>
#include <QSystemTrayIcon> #include <QSystemTrayIcon>
#include <QTimer> #include <QTimer>
#include <QDir> #include <QDir>

3
src/webui/abstractwebapplication.cpp

@ -36,6 +36,7 @@
#include <QTimer> #include <QTimer>
#include "base/preferences.h" #include "base/preferences.h"
#include "base/utils/fs.h"
#include "websessiondata.h" #include "websessiondata.h"
#include "abstractwebapplication.h" #include "abstractwebapplication.h"
@ -382,7 +383,7 @@ bool AbstractWebApplication::sessionEnd()
QString AbstractWebApplication::saveTmpFile(const QByteArray &data) QString AbstractWebApplication::saveTmpFile(const QByteArray &data)
{ {
QTemporaryFile tmpfile(QDir::temp().absoluteFilePath("qBT-XXXXXX.torrent")); QTemporaryFile tmpfile(Utils::Fs::tempPath() + "XXXXXX.torrent");
tmpfile.setAutoRemove(false); tmpfile.setAutoRemove(false);
if (tmpfile.open()) { if (tmpfile.open()) {
tmpfile.write(data); tmpfile.write(data);

Loading…
Cancel
Save