mirror of
https://github.com/transmission/transmission
synced 2024-12-26 01:27:28 +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 setStringValue: name];
|
||||||
[fNameField setToolTip: fPath];
|
[fNameField setToolTip: fPath];
|
||||||
|
|
||||||
BOOL multifile = !fInfo->isSingleFile;
|
const BOOL multifile = !fInfo->isSingleFile;
|
||||||
|
|
||||||
NSImage * icon = [[NSWorkspace sharedWorkspace] iconForFileType: multifile
|
NSImage * icon = [[NSWorkspace sharedWorkspace] iconForFileType: multifile
|
||||||
? NSFileTypeForHFSTypeCode('fldr') : [fPath pathExtension]];
|
? NSFileTypeForHFSTypeCode('fldr') : [fPath pathExtension]];
|
||||||
|
@ -162,13 +162,12 @@
|
||||||
}
|
}
|
||||||
[fStatusField setStringValue: statusString];
|
[fStatusField setStringValue: statusString];
|
||||||
|
|
||||||
const int piecesCount = fInfo->pieceCount;
|
if (fInfo->pieceCount == 1)
|
||||||
if (piecesCount == 1)
|
|
||||||
[fPiecesField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"1 piece, %@", "Create torrent -> info"),
|
[fPiecesField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"1 piece, %@", "Create torrent -> info"),
|
||||||
[NSString stringForFileSize: fInfo->pieceSize]]];
|
[NSString stringForFileSize: fInfo->pieceSize]]];
|
||||||
else
|
else
|
||||||
[fPiecesField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%d pieces, %@ each", "Create torrent -> info"),
|
[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:
|
fLocation = [[[[fDefaults stringForKey: @"CreatorLocation"] stringByExpandingTildeInPath] stringByAppendingPathComponent:
|
||||||
[name stringByAppendingPathExtension: @"torrent"]] retain];
|
[name stringByAppendingPathExtension: @"torrent"]] retain];
|
||||||
|
|
|
@ -419,10 +419,13 @@ tr_session * fHandle;
|
||||||
{
|
{
|
||||||
NSMutableArray * sounds = [NSMutableArray array];
|
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)
|
for (NSString * directory in directories)
|
||||||
{
|
{
|
||||||
|
directory = [directory stringByAppendingPathComponent: @"Sounds"];
|
||||||
|
|
||||||
BOOL isDirectory;
|
BOOL isDirectory;
|
||||||
if ([[NSFileManager defaultManager] fileExistsAtPath: directory isDirectory: &isDirectory] && isDirectory)
|
if ([[NSFileManager defaultManager] fileExistsAtPath: directory isDirectory: &isDirectory] && isDirectory)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue