From 515ac1be3647e61fff1cb09df4379bd951458856 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 4 Aug 2010 16:25:30 +0000 Subject: [PATCH] (trunk qt) #3482 "Handle common user errors when adding an existing torrent" -- fixed --- qt/options.cc | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/qt/options.cc b/qt/options.cc index b588f1b98..9a55ea3f8 100644 --- a/qt/options.cc +++ b/qt/options.cc @@ -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( ); -- 2.40.0