mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-01 05:08:05 -06:00
Replace single-character string with character literal
Also remove unnecessary dynamic allocation.
This commit is contained in:
committed by
sledgehammer999
parent
d088ab6f43
commit
9e99a0d3f5
@@ -46,7 +46,7 @@ namespace
|
||||
rawBc = rawBc.mid(8); // skip bc://bt/
|
||||
rawBc = QByteArray::fromBase64(rawBc); // Decode base64
|
||||
// Format is now AA/url_encoded_filename/size_bytes/info_hash/ZZ
|
||||
QStringList parts = QString(rawBc).split("/");
|
||||
QStringList parts = QString(rawBc).split('/');
|
||||
if (parts.size() != 5) return QString();
|
||||
|
||||
QString filename = parts.at(1);
|
||||
|
||||
@@ -377,7 +377,7 @@ void PeerInfo::determineFlags()
|
||||
|
||||
// L = Peer is local
|
||||
if (fromLSD()) {
|
||||
m_flags += "L";
|
||||
m_flags += 'L';
|
||||
flagsDescriptionList += "L = "
|
||||
+ tr("peer from LSD");
|
||||
}
|
||||
|
||||
@@ -688,7 +688,7 @@ QString Session::torrentTempPath(const TorrentInfo &torrentInfo) const
|
||||
if ((torrentInfo.filesCount() > 1) && !torrentInfo.hasRootFolder())
|
||||
return tempPath()
|
||||
+ QString::fromStdString(torrentInfo.nativeInfo()->orig_files().name())
|
||||
+ "/";
|
||||
+ '/';
|
||||
|
||||
return tempPath();
|
||||
}
|
||||
@@ -793,7 +793,7 @@ bool Session::removeCategory(const QString &name)
|
||||
bool result = false;
|
||||
if (isSubcategoriesEnabled()) {
|
||||
// remove subcategories
|
||||
const QString test = name + "/";
|
||||
const QString test = name + '/';
|
||||
Dict::removeIf(m_categories, [this, &test, &result](const QString &category, const QString &)
|
||||
{
|
||||
if (category.startsWith(test)) {
|
||||
@@ -3664,7 +3664,7 @@ void Session::handleTorrentFinished(TorrentHandle *const torrent)
|
||||
const QString torrentRelpath = torrent->filePath(i);
|
||||
if (torrentRelpath.endsWith(".torrent", Qt::CaseInsensitive)) {
|
||||
qDebug("Found possible recursive torrent download.");
|
||||
const QString torrentFullpath = torrent->savePath(true) + "/" + torrentRelpath;
|
||||
const QString torrentFullpath = torrent->savePath(true) + '/' + torrentRelpath;
|
||||
qDebug("Full subtorrent path is %s", qUtf8Printable(torrentFullpath));
|
||||
TorrentInfo torrentInfo = TorrentInfo::loadFromFile(torrentFullpath);
|
||||
if (torrentInfo.isValid()) {
|
||||
@@ -3814,7 +3814,7 @@ void Session::recursiveTorrentDownload(const InfoHash &hash)
|
||||
tr("Recursive download of file '%1' embedded in torrent '%2'"
|
||||
, "Recursive download of 'test.torrent' embedded in torrent 'test2'")
|
||||
.arg(Utils::Fs::toNativePath(torrentRelpath), torrent->name()));
|
||||
const QString torrentFullpath = torrent->savePath() + "/" + torrentRelpath;
|
||||
const QString torrentFullpath = torrent->savePath() + '/' + torrentRelpath;
|
||||
|
||||
AddTorrentParams params;
|
||||
// Passing the save path along to the sub torrent file
|
||||
@@ -4309,7 +4309,7 @@ void Session::handleListenSucceededAlert(libt::listen_succeeded_alert *p)
|
||||
proto = "TCP";
|
||||
else if (p->sock_type == libt::listen_succeeded_alert::tcp_ssl)
|
||||
proto = "TCP_SSL";
|
||||
qDebug() << "Successfully listening on " << proto << p->endpoint.address().to_string(ec).c_str() << "/" << p->endpoint.port();
|
||||
qDebug() << "Successfully listening on " << proto << p->endpoint.address().to_string(ec).c_str() << '/' << p->endpoint.port();
|
||||
Logger::instance()->addMessage(
|
||||
tr("qBittorrent is successfully listening on interface %1 port: %2/%3", "e.g: qBittorrent is successfully listening on interface 192.168.0.1 port: TCP/6881")
|
||||
.arg(p->endpoint.address().to_string(ec).c_str(), proto, QString::number(p->endpoint.port())), Log::INFO);
|
||||
@@ -4336,7 +4336,7 @@ void Session::handleListenFailedAlert(libt::listen_failed_alert *p)
|
||||
proto = "I2P";
|
||||
else if (p->sock_type == libt::listen_failed_alert::socks5)
|
||||
proto = "SOCKS5";
|
||||
qDebug() << "Failed listening on " << proto << p->endpoint.address().to_string(ec).c_str() << "/" << p->endpoint.port();
|
||||
qDebug() << "Failed listening on " << proto << p->endpoint.address().to_string(ec).c_str() << '/' << p->endpoint.port();
|
||||
Logger::instance()->addMessage(
|
||||
tr("qBittorrent failed listening on interface %1 port: %2/%3. Reason: %4.",
|
||||
"e.g: qBittorrent failed listening on interface 192.168.0.1 port: TCP/6881. Reason: already in use.")
|
||||
|
||||
@@ -89,7 +89,7 @@ void TorrentCreatorThread::run()
|
||||
emit updateProgress(0);
|
||||
|
||||
try {
|
||||
const QString parentPath = Utils::Fs::branchPath(m_params.inputPath) + "/";
|
||||
const QString parentPath = Utils::Fs::branchPath(m_params.inputPath) + '/';
|
||||
|
||||
// Adding files to the torrent
|
||||
libt::file_storage fs;
|
||||
|
||||
@@ -328,7 +328,7 @@ QString TorrentHandle::rootPath(bool actual) const
|
||||
return QString();
|
||||
|
||||
QString firstFilePath = filePath(0);
|
||||
const int slashIndex = firstFilePath.indexOf("/");
|
||||
const int slashIndex = firstFilePath.indexOf('/');
|
||||
if (slashIndex >= 0)
|
||||
return QDir(savePath(actual)).absoluteFilePath(firstFilePath.left(slashIndex));
|
||||
else
|
||||
@@ -556,7 +556,7 @@ bool TorrentHandle::belongsToCategory(const QString &category) const
|
||||
|
||||
if (m_category == category) return true;
|
||||
|
||||
if (m_session->isSubcategoriesEnabled() && m_category.startsWith(category + "/"))
|
||||
if (m_session->isSubcategoriesEnabled() && m_category.startsWith(category + '/'))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -1683,12 +1683,12 @@ void TorrentHandle::handleFileRenamedAlert(const libtorrent::file_renamed_alert
|
||||
// TODO: Check this!
|
||||
if (filesCount() > 1) {
|
||||
// Check if folders were renamed
|
||||
QStringList oldPathParts = m_torrentInfo.origFilePath(p->index).split("/");
|
||||
QStringList oldPathParts = m_torrentInfo.origFilePath(p->index).split('/');
|
||||
oldPathParts.removeLast();
|
||||
QString oldPath = oldPathParts.join("/");
|
||||
QStringList newPathParts = newName.split("/");
|
||||
QString oldPath = oldPathParts.join('/');
|
||||
QStringList newPathParts = newName.split('/');
|
||||
newPathParts.removeLast();
|
||||
QString newPath = newPathParts.join("/");
|
||||
QString newPath = newPathParts.join('/');
|
||||
if (!newPathParts.isEmpty() && (oldPath != newPath)) {
|
||||
qDebug("oldPath(%s) != newPath(%s)", qUtf8Printable(oldPath), qUtf8Printable(newPath));
|
||||
oldPath = QString("%1/%2").arg(savePath(true), oldPath);
|
||||
@@ -2018,7 +2018,7 @@ void TorrentHandle::prioritizeFiles(const QVector<int> &priorities)
|
||||
// Make sure the file does not already exists
|
||||
if (QDir(parentAbsPath).dirName() != ".unwanted") {
|
||||
QString unwantedAbsPath = parentAbsPath + "/.unwanted";
|
||||
QString newAbsPath = unwantedAbsPath + "/" + Utils::Fs::fileName(filepath);
|
||||
QString newAbsPath = unwantedAbsPath + '/' + Utils::Fs::fileName(filepath);
|
||||
qDebug() << "Unwanted path is" << unwantedAbsPath;
|
||||
if (QFile::exists(newAbsPath)) {
|
||||
qWarning() << "File" << newAbsPath << "already exists at destination.";
|
||||
@@ -2038,8 +2038,8 @@ void TorrentHandle::prioritizeFiles(const QVector<int> &priorities)
|
||||
}
|
||||
#endif
|
||||
QString parentPath = Utils::Fs::branchPath(filepath);
|
||||
if (!parentPath.isEmpty() && !parentPath.endsWith("/"))
|
||||
parentPath += "/";
|
||||
if (!parentPath.isEmpty() && !parentPath.endsWith('/'))
|
||||
parentPath += '/';
|
||||
renameFile(i, parentPath + ".unwanted/" + Utils::Fs::fileName(filepath));
|
||||
}
|
||||
}
|
||||
@@ -2056,8 +2056,8 @@ void TorrentHandle::prioritizeFiles(const QVector<int> &priorities)
|
||||
renameFile(i, QDir(newRelPath).filePath(oldName));
|
||||
|
||||
// Remove .unwanted directory if empty
|
||||
qDebug() << "Attempting to remove .unwanted folder at " << QDir(spath + "/" + newRelPath).absoluteFilePath(".unwanted");
|
||||
QDir(spath + "/" + newRelPath).rmdir(".unwanted");
|
||||
qDebug() << "Attempting to remove .unwanted folder at " << QDir(spath + '/' + newRelPath).absoluteFilePath(".unwanted");
|
||||
QDir(spath + '/' + newRelPath).rmdir(".unwanted");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ bool Peer::operator==(const Peer &other) const
|
||||
|
||||
QString Peer::uid() const
|
||||
{
|
||||
return ip + ":" + QString::number(port);
|
||||
return ip + ':' + QString::number(port);
|
||||
}
|
||||
|
||||
libtorrent::entry Peer::toEntry(bool noPeerId) const
|
||||
|
||||
@@ -181,7 +181,7 @@ void DNSUpdater::processIPUpdateReply(const QString &reply)
|
||||
{
|
||||
Logger *const logger = Logger::instance();
|
||||
qDebug() << Q_FUNC_INFO << reply;
|
||||
QString code = reply.split(" ").first();
|
||||
QString code = reply.split(' ').first();
|
||||
qDebug() << Q_FUNC_INFO << "Code:" << code;
|
||||
|
||||
if ((code == "good") || (code == "nochg")) {
|
||||
|
||||
@@ -299,7 +299,7 @@ QByteArray Smtp::encodeMimeHeader(const QString &key, const QString &value, QTex
|
||||
if (firstWord)
|
||||
line += word;
|
||||
else
|
||||
line += " " + word;
|
||||
line += ' ' + word;
|
||||
firstWord = false;
|
||||
}
|
||||
}
|
||||
@@ -423,7 +423,7 @@ void Smtp::authenticate()
|
||||
// Skip authentication
|
||||
logError("The SMTP server does not seem to support any of the authentications modes "
|
||||
"we support [CRAM-MD5|PLAIN|LOGIN], skipping authentication, "
|
||||
"knowing it is likely to fail... Server Auth Modes: " + auth.join("|"));
|
||||
"knowing it is likely to fail... Server Auth Modes: " + auth.join('|'));
|
||||
m_state = Authenticated;
|
||||
// At this point the server will not send any response
|
||||
// So fill the buffer with a fake one to pass the tests
|
||||
@@ -503,7 +503,7 @@ void Smtp::authLogin()
|
||||
void Smtp::logError(const QString &msg)
|
||||
{
|
||||
qDebug() << "Email Notification Error:" << msg;
|
||||
Logger::instance()->addMessage(tr("Email Notification Error:") + " " + msg, Log::CRITICAL);
|
||||
Logger::instance()->addMessage(tr("Email Notification Error:") + ' ' + msg, Log::CRITICAL);
|
||||
}
|
||||
|
||||
QString Smtp::getCurrentDateTime() const
|
||||
@@ -529,7 +529,7 @@ QString Smtp::getCurrentDateTime() const
|
||||
std::snprintf(buf, sizeof(buf), "%+05d", timeOffset);
|
||||
QString timeOffsetStr = buf;
|
||||
|
||||
QString ret = weekDayStr + ", " + dayStr + " " + monthStr + " " + yearStr + " " + timeStr + " " + timeOffsetStr;
|
||||
QString ret = weekDayStr + ", " + dayStr + ' ' + monthStr + ' ' + yearStr + ' ' + timeStr + ' ' + timeOffsetStr;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -256,7 +256,7 @@ void Preferences::setWinStartup(bool b)
|
||||
{
|
||||
QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat);
|
||||
if (b) {
|
||||
const QString binPath = "\"" + Utils::Fs::toNativePath(qApp->applicationFilePath()) + "\"";
|
||||
const QString binPath = '"' + Utils::Fs::toNativePath(qApp->applicationFilePath()) + '"';
|
||||
settings.setValue("qBittorrent", binPath);
|
||||
}
|
||||
else {
|
||||
@@ -500,7 +500,7 @@ void Preferences::setWebUiAuthSubnetWhitelist(QStringList subnets)
|
||||
|
||||
QString Preferences::getServerDomains() const
|
||||
{
|
||||
return value("Preferences/WebUI/ServerDomains", "*").toString();
|
||||
return value("Preferences/WebUI/ServerDomains", '*').toString();
|
||||
}
|
||||
|
||||
void Preferences::setServerDomains(const QString &str)
|
||||
@@ -510,7 +510,7 @@ void Preferences::setServerDomains(const QString &str)
|
||||
|
||||
QString Preferences::getWebUiAddress() const
|
||||
{
|
||||
return value("Preferences/WebUI/Address", "*").toString().trimmed();
|
||||
return value("Preferences/WebUI/Address", '*').toString().trimmed();
|
||||
}
|
||||
|
||||
void Preferences::setWebUiAddress(const QString &addr)
|
||||
@@ -987,7 +987,7 @@ QString Preferences::getPythonPath()
|
||||
// Fallback: Detect python from default locations
|
||||
const QStringList dirs = QDir("C:/").entryList(QStringList("Python*"), QDir::Dirs, QDir::Name | QDir::Reversed);
|
||||
foreach (const QString &dir, dirs) {
|
||||
const QString path("C:/" + dir + "/");
|
||||
const QString path("C:/" + dir + '/');
|
||||
if (QFile::exists(path + "python.exe"))
|
||||
return path;
|
||||
}
|
||||
@@ -1058,8 +1058,8 @@ void Preferences::setMagnetLinkAssoc(bool set)
|
||||
|
||||
// Magnet association
|
||||
if (set) {
|
||||
const QString commandStr = "\"" + qApp->applicationFilePath() + "\" \"%1\"";
|
||||
const QString iconStr = "\"" + qApp->applicationFilePath() + "\",1";
|
||||
const QString commandStr = '"' + qApp->applicationFilePath() + "\" \"%1\"";
|
||||
const QString iconStr = '"' + qApp->applicationFilePath() + "\",1";
|
||||
|
||||
settings.setValue("magnet/Default", "URL:Magnet link");
|
||||
settings.setValue("magnet/Content Type", "application/x-magnet");
|
||||
|
||||
@@ -502,7 +502,7 @@ void AutoDownloadRule::setMustContain(const QString &tokens)
|
||||
if (m_dataPtr->useRegex)
|
||||
m_dataPtr->mustContain = QStringList() << tokens;
|
||||
else
|
||||
m_dataPtr->mustContain = tokens.split("|");
|
||||
m_dataPtr->mustContain = tokens.split('|');
|
||||
|
||||
// Check for single empty string - if so, no condition
|
||||
if ((m_dataPtr->mustContain.size() == 1) && m_dataPtr->mustContain[0].isEmpty())
|
||||
@@ -516,7 +516,7 @@ void AutoDownloadRule::setMustNotContain(const QString &tokens)
|
||||
if (m_dataPtr->useRegex)
|
||||
m_dataPtr->mustNotContain = QStringList() << tokens;
|
||||
else
|
||||
m_dataPtr->mustNotContain = tokens.split("|");
|
||||
m_dataPtr->mustNotContain = tokens.split('|');
|
||||
|
||||
// Check for single empty string - if so, no condition
|
||||
if ((m_dataPtr->mustNotContain.size() == 1) && m_dataPtr->mustNotContain[0].isEmpty())
|
||||
@@ -605,12 +605,12 @@ int AutoDownloadRule::ignoreDays() const
|
||||
|
||||
QString AutoDownloadRule::mustContain() const
|
||||
{
|
||||
return m_dataPtr->mustContain.join("|");
|
||||
return m_dataPtr->mustContain.join('|');
|
||||
}
|
||||
|
||||
QString AutoDownloadRule::mustNotContain() const
|
||||
{
|
||||
return m_dataPtr->mustNotContain.join("|");
|
||||
return m_dataPtr->mustNotContain.join('|');
|
||||
}
|
||||
|
||||
bool AutoDownloadRule::useSmartFilter() const
|
||||
|
||||
@@ -65,13 +65,13 @@ SearchHandler::SearchHandler(const QString &pattern, const QString &category, co
|
||||
|
||||
const QStringList params {
|
||||
Utils::Fs::toNativePath(m_manager->engineLocation() + "/nova2.py"),
|
||||
m_usedPlugins.join(","),
|
||||
m_usedPlugins.join(','),
|
||||
m_category
|
||||
};
|
||||
|
||||
// Launch search
|
||||
m_searchProcess->setProgram(Utils::ForeignApps::pythonInfo().executableName);
|
||||
m_searchProcess->setArguments(params + m_pattern.split(" "));
|
||||
m_searchProcess->setArguments(params + m_pattern.split(' '));
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
|
||||
connect(m_searchProcess, &QProcess::errorOccurred, this, &SearchHandler::processFailed);
|
||||
@@ -161,7 +161,7 @@ void SearchHandler::processFailed()
|
||||
// file url | file name | file size | nb seeds | nb leechers | Search engine url
|
||||
bool SearchHandler::parseSearchResult(const QString &line, SearchResult &searchResult)
|
||||
{
|
||||
const QStringList parts = line.split("|");
|
||||
const QStringList parts = line.split('|');
|
||||
const int nbFields = parts.size();
|
||||
if (nbFields < (NB_PLUGIN_COLUMNS - 1)) return false; // -1 because desc_link is optional
|
||||
|
||||
|
||||
@@ -204,7 +204,7 @@ void SearchPluginManager::installPlugin(const QString &source)
|
||||
path = QUrl(path).toLocalFile();
|
||||
|
||||
QString pluginName = Utils::Fs::fileName(path);
|
||||
pluginName.chop(pluginName.size() - pluginName.lastIndexOf("."));
|
||||
pluginName.chop(pluginName.size() - pluginName.lastIndexOf('.'));
|
||||
|
||||
if (!path.endsWith(".py", Qt::CaseInsensitive))
|
||||
emit pluginInstallationFailed(pluginName, tr("Unknown search engine plugin file format."));
|
||||
@@ -375,7 +375,7 @@ void SearchPluginManager::pluginDownloaded(const QString &url, QString filePath)
|
||||
filePath = Utils::Fs::fromNativePath(filePath);
|
||||
|
||||
QString pluginName = Utils::Fs::fileName(url);
|
||||
pluginName.chop(pluginName.size() - pluginName.lastIndexOf(".")); // Remove extension
|
||||
pluginName.chop(pluginName.size() - pluginName.lastIndexOf('.')); // Remove extension
|
||||
installPlugin_impl(pluginName, filePath);
|
||||
Utils::Fs::forceRemove(filePath);
|
||||
}
|
||||
@@ -502,13 +502,13 @@ void SearchPluginManager::parseVersionInfo(const QByteArray &info)
|
||||
foreach (QByteArray line, lines) {
|
||||
line = line.trimmed();
|
||||
if (line.isEmpty()) continue;
|
||||
if (line.startsWith("#")) continue;
|
||||
if (line.startsWith('#')) continue;
|
||||
|
||||
QList<QByteArray> list = line.split(' ');
|
||||
if (list.size() != 2) continue;
|
||||
|
||||
QString pluginName = QString(list.first());
|
||||
if (!pluginName.endsWith(":")) continue;
|
||||
if (!pluginName.endsWith(':')) continue;
|
||||
|
||||
pluginName.chop(1); // remove trailing ':'
|
||||
PluginVersion version = PluginVersion::tryParse(list.last(), {});
|
||||
|
||||
@@ -78,14 +78,14 @@ QString Utils::Fs::fromNativePath(const QString &path)
|
||||
QString Utils::Fs::fileExtension(const QString &filename)
|
||||
{
|
||||
QString ext = QString(filename).remove(QB_EXT);
|
||||
const int pointIndex = ext.lastIndexOf(".");
|
||||
const int pointIndex = ext.lastIndexOf('.');
|
||||
return (pointIndex >= 0) ? ext.mid(pointIndex + 1) : QString();
|
||||
}
|
||||
|
||||
QString Utils::Fs::fileName(const QString &filePath)
|
||||
{
|
||||
QString path = fromNativePath(filePath);
|
||||
const int slashIndex = path.lastIndexOf("/");
|
||||
const int slashIndex = path.lastIndexOf('/');
|
||||
if (slashIndex == -1)
|
||||
return path;
|
||||
return path.mid(slashIndex + 1);
|
||||
@@ -94,7 +94,7 @@ QString Utils::Fs::fileName(const QString &filePath)
|
||||
QString Utils::Fs::folderName(const QString &filePath)
|
||||
{
|
||||
QString path = fromNativePath(filePath);
|
||||
const int slashIndex = path.lastIndexOf("/");
|
||||
const int slashIndex = path.lastIndexOf('/');
|
||||
if (slashIndex == -1)
|
||||
return path;
|
||||
return path.left(slashIndex);
|
||||
@@ -121,13 +121,13 @@ bool Utils::Fs::smartRemoveEmptyFolderTree(const QString &path)
|
||||
};
|
||||
|
||||
// travel from the deepest folder and remove anything unwanted on the way out.
|
||||
QStringList dirList(path + "/"); // get all sub directories paths
|
||||
QStringList dirList(path + '/'); // get all sub directories paths
|
||||
QDirIterator iter(path, (QDir::AllDirs | QDir::NoDotAndDotDot), QDirIterator::Subdirectories);
|
||||
while (iter.hasNext())
|
||||
dirList << iter.next() + "/";
|
||||
dirList << iter.next() + '/';
|
||||
// sort descending by directory depth
|
||||
std::sort(dirList.begin(), dirList.end()
|
||||
, [](const QString &l, const QString &r) { return l.count("/") > r.count("/"); });
|
||||
, [](const QString &l, const QString &r) { return l.count('/') > r.count('/'); });
|
||||
|
||||
for (const QString &p : qAsConst(dirList)) {
|
||||
// remove unwanted files
|
||||
@@ -139,7 +139,7 @@ bool Utils::Fs::smartRemoveEmptyFolderTree(const QString &path)
|
||||
QDir dir(p);
|
||||
QStringList tmpFileList = dir.entryList(QDir::Files);
|
||||
for (const QString &f : tmpFileList) {
|
||||
if (f.endsWith("~"))
|
||||
if (f.endsWith('~'))
|
||||
forceRemove(p + f);
|
||||
}
|
||||
|
||||
@@ -246,9 +246,9 @@ qint64 Utils::Fs::freeDiskSpaceOnPath(const QString &path)
|
||||
QString Utils::Fs::branchPath(const QString &filePath, QString *removed)
|
||||
{
|
||||
QString ret = fromNativePath(filePath);
|
||||
if (ret.endsWith("/"))
|
||||
if (ret.endsWith('/'))
|
||||
ret.chop(1);
|
||||
const int slashIndex = ret.lastIndexOf("/");
|
||||
const int slashIndex = ret.lastIndexOf('/');
|
||||
if (slashIndex >= 0) {
|
||||
if (removed)
|
||||
*removed = ret.mid(slashIndex + 1);
|
||||
|
||||
@@ -501,7 +501,7 @@ void Utils::Misc::openFolderSelect(const QString &absolutePath)
|
||||
const QString path = Utils::Fs::fromNativePath(absolutePath);
|
||||
// If the item to select doesn't exist, try to open its parent
|
||||
if (!QFileInfo::exists(path)) {
|
||||
openPath(path.left(path.lastIndexOf("/")));
|
||||
openPath(path.left(path.lastIndexOf('/')));
|
||||
return;
|
||||
}
|
||||
#ifdef Q_OS_WIN
|
||||
@@ -540,10 +540,10 @@ void Utils::Misc::openFolderSelect(const QString &absolutePath)
|
||||
}
|
||||
else {
|
||||
// "caja" manager can't pinpoint the file, see: https://github.com/qbittorrent/qBittorrent/issues/5003
|
||||
openPath(path.left(path.lastIndexOf("/")));
|
||||
openPath(path.left(path.lastIndexOf('/')));
|
||||
}
|
||||
#else
|
||||
openPath(path.left(path.lastIndexOf("/")));
|
||||
openPath(path.left(path.lastIndexOf('/')));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user