Paths converted from NSString objects to C strings should be acquired using “-fileSystemRepresentation”.

The file system APIs on OS X have specific requirements concerning the Unicode normalization form.
This commit is contained in:
Jan Weiß 2016-05-15 18:42:37 +02:00
parent e60e75fadc
commit 4a9a48853b
1 changed files with 7 additions and 3 deletions

View File

@ -845,7 +845,8 @@
[fDefaults setBool: YES forKey: @"DownloadLocationConstant"];
[self updateShowAddMagnetWindowField];
tr_sessionSetDownloadDir(fHandle, [folder UTF8String]);
assert(folder.length > 0);
tr_sessionSetDownloadDir(fHandle, [folder fileSystemRepresentation]);
}
else
{
@ -871,7 +872,8 @@
NSString * folder = [[[panel URLs] objectAtIndex: 0] path];
[fDefaults setObject: folder forKey: @"IncompleteDownloadFolder"];
tr_sessionSetIncompleteDir(fHandle, [folder UTF8String]);
assert(folder.length > 0);
tr_sessionSetIncompleteDir(fHandle, [folder fileSystemRepresentation]);
}
[fIncompleteFolderPopUp selectItemAtIndex: 0];
}];
@ -892,8 +894,10 @@
{
NSString * filePath = [[[panel URLs] objectAtIndex: 0] path];
assert(filePath.length > 0);
[fDefaults setObject: filePath forKey: @"DoneScriptPath"];
tr_sessionSetTorrentDoneScript(fHandle, [filePath UTF8String]);
tr_sessionSetTorrentDoneScript(fHandle, [filePath fileSystemRepresentation]);
[fDefaults setBool: YES forKey: @"DoneScriptEnabled"];
tr_sessionSetTorrentDoneScriptEnabled(fHandle, YES);