mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-22 20:44:15 +00:00
Fix "Open destination folder" that would open a subfolder instead (closes #607510)
This commit is contained in:
parent
385f950c2b
commit
a91ad3c9c7
@ -450,15 +450,6 @@ bool QTorrentHandle::priv() const {
|
||||
return h.get_torrent_info().priv();
|
||||
}
|
||||
|
||||
QString QTorrentHandle::root_path() const {
|
||||
Q_ASSERT(h.is_valid());
|
||||
if(num_files() == 0) return "";
|
||||
QStringList path_list = misc::toQStringU(h.get_torrent_info().file_at(0).path.string()).split("/");
|
||||
if(path_list.size() > 1)
|
||||
return save_path()+"/"+path_list.first();
|
||||
return save_path();
|
||||
}
|
||||
|
||||
QString QTorrentHandle::firstFileSavePath() const {
|
||||
Q_ASSERT(h.is_valid());
|
||||
Q_ASSERT(has_metadata());
|
||||
|
@ -601,10 +601,11 @@ void TransferListWidget::torrentDoubleClicked(const QModelIndex& index) {
|
||||
}
|
||||
break;
|
||||
case OPEN_DEST:
|
||||
if(h.has_metadata())
|
||||
QDesktopServices::openUrl(QUrl("file://" + h.root_path()));
|
||||
else
|
||||
#ifdef Q_WS_WIN
|
||||
QDesktopServices::openUrl(QUrl("file:///" + h.save_path()));
|
||||
#else
|
||||
QDesktopServices::openUrl(QUrl("file://" + h.save_path()));
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -764,7 +765,7 @@ void TransferListWidget::openSelectedTorrentsFolder() const {
|
||||
foreach(const QString &hash, hashes) {
|
||||
const QTorrentHandle &h = BTSession->getTorrentHandle(hash);
|
||||
if(h.is_valid()) {
|
||||
const QString &savePath = h.root_path();
|
||||
const QString &savePath = h.save_path();
|
||||
qDebug("Opening path at %s", qPrintable(savePath));
|
||||
if(!pathsList.contains(savePath)) {
|
||||
pathsList.append(savePath);
|
||||
|
Loading…
x
Reference in New Issue
Block a user