]> granicus.if.org Git - transmission/commitdiff
(trunk qt) #3482 "Handle common user errors when adding an existing torrent" -- fixed
authorCharles Kerr <charles@transmissionbt.com>
Wed, 4 Aug 2010 16:25:30 +0000 (16:25 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Wed, 4 Aug 2010 16:25:30 +0000 (16:25 +0000)
qt/options.cc

index b588f1b98b6ce7f7683952c6c367c40e72987a0c..9a55ea3f8fef8dd0f6e32adabf9b5af470f01482 100644 (file)
@@ -549,7 +549,27 @@ Options :: onTimeout( )
         myVerifyFilePos = 0;
     }
 
-    const bool done = myVerifyPieceIndex >= myInfo.pieceCount;
+    bool done = myVerifyPieceIndex >= myInfo.pieceCount;
+    if( done )
+    {
+        uint64_t have = 0;
+        foreach( const TrFile& f, myFiles )
+            have += f.have;
+
+        if( !have ) // everything failed
+        {
+            // did the user accidentally specify the child directory instead of the parent?
+            const QStringList tokens = QString(file->name).split('/');
+            if( !tokens.empty() && myDestination.dirName()==tokens.at(0) )
+            {
+                // move up one directory and try again
+                myDestination.cdUp( );
+                refreshDestinationButton( -1 );
+                onVerify( );
+                done = false;
+            }
+        }
+    }
 
     if( done )
         myVerifyTimer.stop( );