mirror of
https://github.com/transmission/transmission
synced 2024-12-25 01:03:01 +00:00
use NSSearchPathForDirectoriesInDomains() for searching for sounds
This commit is contained in:
parent
43e3ed2c1c
commit
38821fbee6
2 changed files with 7 additions and 5 deletions
|
@ -142,7 +142,7 @@
|
|||
[fNameField setStringValue: name];
|
||||
[fNameField setToolTip: fPath];
|
||||
|
||||
BOOL multifile = !fInfo->isSingleFile;
|
||||
const BOOL multifile = !fInfo->isSingleFile;
|
||||
|
||||
NSImage * icon = [[NSWorkspace sharedWorkspace] iconForFileType: multifile
|
||||
? NSFileTypeForHFSTypeCode('fldr') : [fPath pathExtension]];
|
||||
|
@ -162,13 +162,12 @@
|
|||
}
|
||||
[fStatusField setStringValue: statusString];
|
||||
|
||||
const int piecesCount = fInfo->pieceCount;
|
||||
if (piecesCount == 1)
|
||||
if (fInfo->pieceCount == 1)
|
||||
[fPiecesField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"1 piece, %@", "Create torrent -> info"),
|
||||
[NSString stringForFileSize: fInfo->pieceSize]]];
|
||||
else
|
||||
[fPiecesField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%d pieces, %@ each", "Create torrent -> info"),
|
||||
piecesCount, [NSString stringForFileSize: fInfo->pieceSize]]];
|
||||
fInfo->pieceCount, [NSString stringForFileSize: fInfo->pieceSize]]];
|
||||
|
||||
fLocation = [[[[fDefaults stringForKey: @"CreatorLocation"] stringByExpandingTildeInPath] stringByAppendingPathComponent:
|
||||
[name stringByAppendingPathExtension: @"torrent"]] retain];
|
||||
|
|
|
@ -419,10 +419,13 @@ tr_session * fHandle;
|
|||
{
|
||||
NSMutableArray * sounds = [NSMutableArray array];
|
||||
|
||||
NSArray * directories = [NSArray arrayWithObjects: @"/System/Library/Sounds", @"/Library/Sounds", @"Library/Sounds", nil];
|
||||
NSArray * directories = NSSearchPathForDirectoriesInDomains(NSAllLibrariesDirectory,
|
||||
NSUserDomainMask | NSLocalDomainMask | NSSystemDomainMask, YES);
|
||||
|
||||
for (NSString * directory in directories)
|
||||
{
|
||||
directory = [directory stringByAppendingPathComponent: @"Sounds"];
|
||||
|
||||
BOOL isDirectory;
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath: directory isDirectory: &isDirectory] && isDirectory)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue