From 4a64ae9fa2cf68af2b5a6965538b055f6ed3a91e Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Sat, 21 Jan 2012 23:28:34 +0000 Subject: [PATCH] use NSFileManager to read/write the torrent history in the Application Support directory, instead of a hard-coded path --- macosx/Controller.m | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/macosx/Controller.m b/macosx/Controller.m index 3f6188b17..ea503cfac 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -126,7 +126,7 @@ typedef enum #define UPDATE_UI_SECONDS 1.0 -#define TRANSFER_PLIST @"/Library/Application Support/Transmission/Transfers.plist" +#define TRANSFER_PLIST @"Transfers.plist" #define WEBSITE_URL @"http://www.transmissionbt.com/" #define FORUM_URL @"http://forum.transmissionbt.com/" @@ -418,8 +418,8 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy NSLog(@"Could not IORegisterForSystemPower"); //load previous transfers - NSArray * history = [NSArray arrayWithContentsOfFile: [NSHomeDirectory() stringByAppendingPathComponent: TRANSFER_PLIST]]; - + NSURL * historyURL = [[[[[NSFileManager defaultManager] URLsForDirectory: NSApplicationSupportDirectory inDomains: NSUserDomainMask] objectAtIndex: 0] URLByAppendingPathComponent: @"Transmission"] URLByAppendingPathComponent: TRANSFER_PLIST]; + NSArray * history = [NSArray arrayWithContentsOfURL: historyURL]; if (!history) { //old version saved transfer info in prefs file @@ -1832,7 +1832,8 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy for (Torrent * torrent in fTorrents) [history addObject: [torrent history]]; - [history writeToFile: [NSHomeDirectory() stringByAppendingPathComponent: TRANSFER_PLIST] atomically: YES]; + NSURL * historyURL = [[[[[NSFileManager defaultManager] URLsForDirectory: NSApplicationSupportDirectory inDomains: NSUserDomainMask] objectAtIndex: 0] URLByAppendingPathComponent: @"Transmission"] URLByAppendingPathComponent: TRANSFER_PLIST]; + [history writeToURL: historyURL atomically: YES]; } - (void) setSort: (id) sender -- 2.40.0