From a59a6ce8e48128f4d3058b1171fd77571b2d5951 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Mon, 11 Apr 2022 12:19:05 +0800 Subject: [PATCH] Remove redundant function This helper function is useless after using `Path` class. --- src/app/application.cpp | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/src/app/application.cpp b/src/app/application.cpp index d3b99d19c..15fa21c52 100644 --- a/src/app/application.cpp +++ b/src/app/application.cpp @@ -324,15 +324,6 @@ void Application::processMessage(const QString &message) void Application::runExternalProgram(const BitTorrent::Torrent *torrent) const { -#if defined(Q_OS_WIN) - const auto chopPathSep = [](const QString &str) -> QString - { - if (str.endsWith(u'\\')) - return str.mid(0, (str.length() -1)); - return str; - }; -#endif - QString program = Preferences::instance()->getAutoRunProgram().trimmed(); for (int i = (program.length() - 2); i >= 0; --i) @@ -347,18 +338,10 @@ void Application::runExternalProgram(const BitTorrent::Torrent *torrent) const program.replace(i, 2, QString::number(torrent->filesCount())); break; case u'D': -#if defined(Q_OS_WIN) - program.replace(i, 2, chopPathSep(torrent->savePath().toString())); -#else program.replace(i, 2, torrent->savePath().toString()); -#endif break; case u'F': -#if defined(Q_OS_WIN) - program.replace(i, 2, chopPathSep(torrent->contentPath().toString())); -#else program.replace(i, 2, torrent->contentPath().toString()); -#endif break; case u'G': program.replace(i, 2, torrent->tags().join(u","_qs)); @@ -379,11 +362,7 @@ void Application::runExternalProgram(const BitTorrent::Torrent *torrent) const program.replace(i, 2, torrent->name()); break; case u'R': -#if defined(Q_OS_WIN) - program.replace(i, 2, chopPathSep(torrent->rootPath().toString())); -#else program.replace(i, 2, torrent->rootPath().toString()); -#endif break; case u'T': program.replace(i, 2, torrent->currentTracker());