1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 09:37:56 +00:00

(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

This commit is contained in:
Jordan Lee 2012-12-27 17:46:11 +00:00
parent fb0ada6582
commit 144d3b952c

View file

@ -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 );
}
}