]> granicus.if.org Git - transmission/commitdiff
(trunk, qt) #5193 'qt: open folder: if the first file in a torrent is not an immediat...
authorJordan Lee <jordan@transmissionbt.com>
Thu, 27 Dec 2012 17:46:11 +0000 (17:46 +0000)
committerJordan Lee <jordan@transmissionbt.com>
Thu, 27 Dec 2012 17:46:11 +0000 (17:46 +0000)
qt/mainwin.cc

index c0e1faefa4dbafbf7dde5e9f8010827822b1c9f2..7fd6be82f69fa8f7f087a24cc61b6bda066db2e2 100644 (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 );
     }
 }