Changeset 13177


Ignore:
Timestamp:
Jan 21, 2012, 11:28:34 PM (10 years ago)
Author:
livings124
Message:

use NSFileManager to read/write the torrent history in the Application Support directory, instead of a hard-coded path

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r13173 r13177  
    127127#define UPDATE_UI_SECONDS   1.0
    128128
    129 #define TRANSFER_PLIST  @"/Library/Application Support/Transmission/Transfers.plist"
     129#define TRANSFER_PLIST  @"Transfers.plist"
    130130
    131131#define WEBSITE_URL @"http://www.transmissionbt.com/"
     
    419419   
    420420    //load previous transfers
    421     NSArray * history = [NSArray arrayWithContentsOfFile: [NSHomeDirectory() stringByAppendingPathComponent: TRANSFER_PLIST]];
    422    
     421    NSURL * historyURL = [[[[[NSFileManager defaultManager] URLsForDirectory: NSApplicationSupportDirectory inDomains: NSUserDomainMask] objectAtIndex: 0] URLByAppendingPathComponent: @"Transmission"] URLByAppendingPathComponent: TRANSFER_PLIST];
     422    NSArray * history = [NSArray arrayWithContentsOfURL: historyURL];
    423423    if (!history)
    424424    {
     
    18331833        [history addObject: [torrent history]];
    18341834   
    1835     [history writeToFile: [NSHomeDirectory() stringByAppendingPathComponent: TRANSFER_PLIST] atomically: YES];
     1835    NSURL * historyURL = [[[[[NSFileManager defaultManager] URLsForDirectory: NSApplicationSupportDirectory inDomains: NSUserDomainMask] objectAtIndex: 0] URLByAppendingPathComponent: @"Transmission"] URLByAppendingPathComponent: TRANSFER_PLIST];
     1836    [history writeToURL: historyURL atomically: YES];
    18361837}
    18371838
Note: See TracChangeset for help on using the changeset viewer.