mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-07-23 08:55:26 +02:00
misc: use QDir for getting a temporary directory
Gitlab: #692 Change-Id: I2f45476c3e5ee4d35ec39c17f923117769c5b652
This commit is contained in:
parent
9f1053902d
commit
4e4c98e232
4 changed files with 7 additions and 25 deletions
|
@ -25,7 +25,6 @@
|
|||
|
||||
#include "appsettingsmanager.h"
|
||||
#include "qtutils.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include <api/datatransfermodel.h>
|
||||
|
||||
|
@ -39,6 +38,7 @@
|
|||
#include <QMimeData>
|
||||
#include <QBuffer>
|
||||
#include <QtMath>
|
||||
#include <QDir>
|
||||
|
||||
MessagesAdapter::MessagesAdapter(AppSettingsManager* settingsManager,
|
||||
PreviewEngine* previewEngine,
|
||||
|
@ -232,8 +232,8 @@ MessagesAdapter::onPaste()
|
|||
auto img_name_hash
|
||||
= QCryptographicHash::hash(QString::number(pixmap.cacheKey()).toLocal8Bit(),
|
||||
QCryptographicHash::Sha1);
|
||||
QString fileName = "\\img_" + QString(img_name_hash.toHex()) + ".png";
|
||||
QString path = QString(Utils::WinGetEnv("TEMP")) + fileName;
|
||||
QString fileName = "img_" + QString(img_name_hash.toHex()) + ".png";
|
||||
QString path = QDir::temp().filePath(fileName);
|
||||
|
||||
if (!pixmap.save(path, "PNG")) {
|
||||
qDebug().noquote() << "Errors during QPixmap save"
|
||||
|
|
|
@ -19,11 +19,11 @@
|
|||
#include "updatemanager.h"
|
||||
|
||||
#include "lrcinstance.h"
|
||||
#include "utils.h"
|
||||
#include "version.h"
|
||||
|
||||
#include <QProcess>
|
||||
#include <QTimer>
|
||||
#include <QDir>
|
||||
|
||||
#ifdef BETA
|
||||
static constexpr bool isBeta = true;
|
||||
|
@ -45,7 +45,7 @@ struct UpdateManager::Impl : public QObject
|
|||
, parent_(parent)
|
||||
, lrcInstance_(instance)
|
||||
, baseUrlString_(url.isEmpty() ? downloadUrl : url)
|
||||
, tempPath_(Utils::WinGetEnv("TEMP"))
|
||||
, tempPath_(QDir::tempPath())
|
||||
, updateTimer_(new QTimer(this))
|
||||
{
|
||||
connect(updateTimer_, &QTimer::timeout, [this] {
|
||||
|
@ -148,8 +148,8 @@ struct UpdateManager::Impl : public QObject
|
|||
|
||||
void cleanUpdateFiles()
|
||||
{
|
||||
// Delete all logs and msi in the %TEMP% directory before launching.
|
||||
QString dir = QString(Utils::WinGetEnv("TEMP"));
|
||||
// Delete all logs and msi in the temporary directory before launching.
|
||||
QString dir = QDir::tempPath();
|
||||
QDir log_dir(dir, {"jami*.log"});
|
||||
for (const QString& filename : log_dir.entryList()) {
|
||||
log_dir.remove(filename);
|
||||
|
|
|
@ -213,23 +213,6 @@ Utils::CheckStartupLink(const std::wstring& wstrAppName)
|
|||
#endif
|
||||
}
|
||||
|
||||
const char*
|
||||
Utils::WinGetEnv(const char* name)
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
const DWORD buffSize = 65535;
|
||||
static char buffer[buffSize];
|
||||
if (GetEnvironmentVariableA(name, buffer, buffSize)) {
|
||||
return buffer;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
Q_UNUSED(name)
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
Utils::removeOldVersions()
|
||||
{
|
||||
|
|
|
@ -62,7 +62,6 @@ bool CreateStartupLink(const std::wstring& wstrAppName);
|
|||
void DeleteStartupLink(const std::wstring& wstrAppName);
|
||||
bool CreateLink(LPCWSTR lpszPathObj, LPCWSTR lpszPathLink);
|
||||
bool CheckStartupLink(const std::wstring& wstrAppName);
|
||||
const char* WinGetEnv(const char* name);
|
||||
QString GetRingtonePath();
|
||||
QString GenGUID();
|
||||
QString GetISODate();
|
||||
|
|
Loading…
Add table
Reference in a new issue