Ignore:
Timestamp:
Oct 21, 2009, 1:01:14 PM (13 years ago)
Author:
livings124
Message:

use libtransmission for moving, incomplete directory, and directory controlling in general (still rough around the edges)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r9328 r9342  
    264264       
    265265        tr_benc settings;
    266         tr_bencInitDict(&settings, 34);
     266        tr_bencInitDict(&settings, 36);
    267267        const char * configDir = tr_getDefaultConfigDir("Transmission");
    268268        tr_sessionGetDefaultSettings(configDir, &settings);
     
    291291        tr_bencDictAddStr(&settings, TR_PREFS_KEY_DOWNLOAD_DIR, [[[fDefaults stringForKey: @"DownloadFolder"]
    292292                                                                    stringByExpandingTildeInPath] UTF8String]);
     293        tr_bencDictAddStr(&settings, TR_PREFS_KEY_INCOMPLETE_DIR, [[[fDefaults stringForKey: @"IncompleteDownloadFolder"]
     294                                                                    stringByExpandingTildeInPath] UTF8String]);
     295        tr_bencDictAddBool(&settings, TR_PREFS_KEY_INCOMPLETE_DIR_ENABLED, [fDefaults boolForKey: @"UseIncompleteDownloadFolder"]);
    293296       
    294297        tr_bencDictAddInt(&settings, TR_PREFS_KEY_MSGLEVEL, [fDefaults integerForKey: @"MessageLevel"]);
     
    941944            continue;
    942945       
    943         //change the location if the group calls for it (this has to wait until after the torrent is create)
     946        //change the location if the group calls for it (this has to wait until after the torrent is created)
    944947        if (!lockDestination && [[GroupsController groups] usesCustomDownloadLocationForIndex: [torrent groupValue]])
    945948        {
    946949            location = [[GroupsController groups] customDownloadLocationForIndex: [torrent groupValue]];
    947             [torrent changeDownloadFolder: location];
     950            [torrent changeDownloadFolderBeforeUsing: location];
    948951        }
    949952       
     
    14651468        NSMutableArray * paths = [NSMutableArray arrayWithCapacity: [selected count]];
    14661469        for (Torrent * torrent in [fTableView selectedTorrents])
    1467             [paths addObject: [NSURL fileURLWithPath: [torrent dataLocation]]];
     1470        {
     1471            NSString * location = [torrent dataLocation];
     1472            if (location)
     1473                [paths addObject: [NSURL fileURLWithPath: location]];
     1474        }
    14681475       
    14691476        [[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs: paths];
     
    14721479    {
    14731480        for (Torrent * torrent in selected)
    1474             [[NSWorkspace sharedWorkspace] selectFile: [torrent dataLocation] inFileViewerRootedAtPath: nil];
     1481        {
     1482            NSString * location = [torrent dataLocation];
     1483            if (location)
     1484                [[NSWorkspace sharedWorkspace] selectFile: location inFileViewerRootedAtPath: nil];
     1485        }
    14751486    }
    14761487}
     
    17701781        }
    17711782       
     1783        #warning dataLocation could return nil
    17721784        NSDictionary * clickContext = [NSDictionary dictionaryWithObjectsAndKeys: GROWL_DOWNLOAD_COMPLETE, @"Type",
    17731785                                        [torrent dataLocation] , @"Location", nil];
     
    17811793        //bounce download stack
    17821794        [[NSDistributedNotificationCenter defaultCenter] postNotificationName: @"com.apple.DownloadFileFinished"
    1783             object: [[torrent downloadFolder] stringByAppendingPathComponent: [torrent name]]];
     1795            object: [torrent dataLocation]];
    17841796       
    17851797        if ([fDefaults boolForKey: @"QueueSeed"] && [self numToStartFromQueue: NO] == 0)
     
    18311843    }
    18321844   
     1845    #warning dataLocation could return nil
    18331846    NSDictionary * clickContext = [NSDictionary dictionaryWithObjectsAndKeys: GROWL_SEEDING_COMPLETE, @"Type",
    18341847                                    [torrent dataLocation], @"Location", nil];
     
    31433156   
    31443157    for (Torrent * torrent in selectedTorrents)
    3145         if (([torrent isFolder] || [torrent isComplete]) && [[NSFileManager defaultManager] fileExistsAtPath: [torrent dataLocation]])
     3158        if (([torrent isFolder] || [torrent isComplete]) && [torrent dataLocation])
    31463159            [qlArray addObject: torrent];
    31473160   
Note: See TracChangeset for help on using the changeset viewer.