NSUserDefaults * fDefaults;
+ NSString * fConfigDirectory;
+
IBOutlet NSWindow * fWindow;
DragOverlayWindow * fOverlayWindow;
IBOutlet TorrentTableView * fTableView;
fLib = tr_sessionInit("macosx", configDir, YES, &settings);
tr_bencFree(&settings);
+ fConfigDirectory = [[NSString alloc] initWithUTF8String: configDir];
+
[NSApp setDelegate: self];
//register for magnet URLs (has to be in init)
NSLog(@"Could not IORegisterForSystemPower");
//load previous transfers
- NSURL * historyURL = [[[[[NSFileManager defaultManager] URLsForDirectory: NSApplicationSupportDirectory inDomains: NSUserDomainMask] objectAtIndex: 0] URLByAppendingPathComponent: @"Transmission"] URLByAppendingPathComponent: TRANSFER_PLIST];
- NSArray * history = [NSArray arrayWithContentsOfURL: historyURL];
+ NSString * historyFile = [fConfigDirectory stringByAppendingPathComponent: TRANSFER_PLIST];
+ NSArray * history = [NSArray arrayWithContentsOfFile: historyFile];
if (!history)
{
//old version saved transfer info in prefs file
[fPreviewPanel release];
+ [fConfigDirectory release];
+
//complete cleanup
tr_sessionClose(fLib);
}
for (Torrent * torrent in fTorrents)
[history addObject: [torrent history]];
- NSURL * historyURL = [[[[[NSFileManager defaultManager] URLsForDirectory: NSApplicationSupportDirectory inDomains: NSUserDomainMask] objectAtIndex: 0] URLByAppendingPathComponent: @"Transmission"] URLByAppendingPathComponent: TRANSFER_PLIST];
- [history writeToURL: historyURL atomically: YES];
+ NSString * historyFile = [fConfigDirectory stringByAppendingPathComponent: TRANSFER_PLIST];
+ [history writeToFile: historyFile atomically: YES];
}
- (void) setSort: (id) sender