mirror of
https://github.com/transmission/transmission
synced 2025-02-03 04:53:27 +00:00
remove a little redundant code from the last commit
This commit is contained in:
parent
d3370ef29e
commit
c36a007cd4
1 changed files with 15 additions and 19 deletions
|
@ -1637,33 +1637,29 @@ int trashDataFile(const char * filename)
|
|||
tr_ctorSetPeerLimit(ctor, TR_FALLBACK, [fDefaults integerForKey: @"PeersTorrent"]);
|
||||
|
||||
tr_info info;
|
||||
int result = TR_EINVALID;
|
||||
if (path)
|
||||
{
|
||||
tr_ctorSetMetainfoFromFile(ctor, [path UTF8String]);
|
||||
if (tr_torrentParse(ctor, &info) == TR_OK)
|
||||
{
|
||||
NSString * currentDownloadFolder = [self shouldUseIncompleteFolderForName: [NSString stringWithUTF8String: info.name]]
|
||||
? fIncompleteFolder : fDownloadFolder;
|
||||
tr_ctorSetDownloadDir(ctor, TR_FORCE, [currentDownloadFolder UTF8String]);
|
||||
|
||||
fHandle = tr_torrentNew(ctor, NULL);
|
||||
}
|
||||
tr_metainfoFree(&info);
|
||||
result = tr_torrentParse(ctor, &info);
|
||||
}
|
||||
if (!fHandle && hashString) //backup - shouldn't be needed after upgrade to 1.70
|
||||
if (result != TR_OK && hashString) //backup - shouldn't be needed after upgrade to 1.70
|
||||
{
|
||||
tr_ctorSetMetainfoFromHash(ctor, [hashString UTF8String]);
|
||||
if (tr_torrentParse(ctor, &info) == TR_OK)
|
||||
{
|
||||
NSString * currentDownloadFolder = [self shouldUseIncompleteFolderForName: [NSString stringWithUTF8String: info.name]]
|
||||
? fIncompleteFolder : fDownloadFolder;
|
||||
tr_ctorSetDownloadDir(ctor, TR_FORCE, [currentDownloadFolder UTF8String]);
|
||||
|
||||
fHandle = tr_torrentNew(ctor, NULL);
|
||||
}
|
||||
tr_metainfoFree(&info);
|
||||
result = tr_torrentParse(ctor, &info);
|
||||
}
|
||||
|
||||
if (result == TR_OK)
|
||||
{
|
||||
NSString * currentDownloadFolder = [self shouldUseIncompleteFolderForName: [NSString stringWithUTF8String: info.name]]
|
||||
? fIncompleteFolder : fDownloadFolder;
|
||||
tr_ctorSetDownloadDir(ctor, TR_FORCE, [currentDownloadFolder UTF8String]);
|
||||
|
||||
fHandle = tr_torrentNew(ctor, NULL);
|
||||
}
|
||||
if (result != TR_EINVALID)
|
||||
tr_metainfoFree(&info);
|
||||
|
||||
tr_ctorFree(ctor);
|
||||
|
||||
if (!fHandle)
|
||||
|
|
Loading…
Reference in a new issue