From 144d3b952c87545e90d2cd10932cf700774ad267 Mon Sep 17 00:00:00 2001 From: Jordan Lee Date: Thu, 27 Dec 2012 17:46:11 +0000 Subject: [PATCH] (trunk, qt) #5193 'qt: open folder: if the first file in a torrent is not an immediate child of the torrent folder, wrong folder opened' -- fixed with patch from basinilya --- qt/mainwin.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/qt/mainwin.cc b/qt/mainwin.cc index c0e1faefa..7fd6be82f 100644 --- a/qt/mainwin.cc +++ b/qt/mainwin.cc @@ -638,14 +638,15 @@ TrMainWindow :: openFolder( ) { const int torrentId( *getSelectedTorrents().begin() ); const Torrent * tor( myModel.getTorrentFromId( torrentId ) ); - const QString path( tor->getPath( ) ); + QString path( tor->getPath( ) ); const FileList files = tor->files(); + const QString firstfile = files.at(0).filename; + int slashIndex = firstfile.indexOf('/'); if (files.size() == 1) openSelect( path + "/" + files.at(0).filename ); else { - QDir dir( path + "/" + files.at(0).filename ); - dir.cdUp(); - openSelect( dir.path() ); + path = path + "/" + firstfile.left(slashIndex); + openSelect( path ); } }