From 7f55d0c672c9b2d04c45eaaca70e98c61f7dabd0 Mon Sep 17 00:00:00 2001 From: brimston3 Date: Thu, 14 Jan 2021 22:22:21 -0500 Subject: [PATCH] Simplify canonical path generation slightly --- src/utils/screenshotsaver.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/utils/screenshotsaver.cpp b/src/utils/screenshotsaver.cpp index 508bc677..3a0d40d0 100644 --- a/src/utils/screenshotsaver.cpp +++ b/src/utils/screenshotsaver.cpp @@ -70,12 +70,8 @@ bool ScreenshotSaver::saveToFilesystem(const QPixmap& capture, ConfigHandler().setSavePath(path); saveMessage = messagePrefix + QObject::tr("Capture saved as ") + completePath; - QString fileNoPath = - completePath.right(completePath.lastIndexOf(QLatin1String("/"))); Controller::getInstance()->sendCaptureSaved( - m_id, - QFileInfo(completePath).canonicalPath() + QLatin1String("/") + - fileNoPath); + m_id, QFileInfo(completePath).canonicalFilePath()); } else { saveMessage = messagePrefix + QObject::tr("Error trying to save as ") + completePath; @@ -116,8 +112,6 @@ bool ScreenshotSaver::saveToFilesystemGUI(const QPixmap& capture) if (ok) { QString pathNoFile = savePath.left(savePath.lastIndexOf(QLatin1String("/"))); - QString fileNoPath = - savePath.right(savePath.lastIndexOf(QLatin1String("/"))); ConfigHandler().setSavePath(pathNoFile); QString msg = QObject::tr("Capture saved as ") + savePath; if (config.copyPathAfterSaveEnabled()) { @@ -128,9 +122,7 @@ bool ScreenshotSaver::saveToFilesystemGUI(const QPixmap& capture) } SystemNotification().sendMessage(msg, savePath); Controller::getInstance()->sendCaptureSaved( - m_id, - QFileInfo(savePath).canonicalPath() + QLatin1String("/") + - fileNoPath); + m_id, QFileInfo(savePath).canonicalFilePath()); } else { QString msg = QObject::tr("Error trying to save as ") + savePath; QMessageBox saveErrBox(