mirror of
https://github.com/transmission/transmission
synced 2025-03-12 15:14:12 +00:00
experiment with supporting custom user sounds on Leopard
This commit is contained in:
parent
1f95e1d450
commit
6ca3f6516b
1 changed files with 12 additions and 13 deletions
|
@ -310,25 +310,24 @@
|
|||
{
|
||||
NSMutableArray * sounds = [NSMutableArray array];
|
||||
|
||||
//until Apple can fix soundNamed to not crash on invalid sound files, don't use custom sounds
|
||||
NSArray * directories = [NSArray arrayWithObjects: @"/System/Library/Sounds", @"/Library/Sounds",
|
||||
/*[NSHomeDirectory() stringByAppendingPathComponent: @"Library/Sounds"],*/ nil];
|
||||
BOOL isDirectory;
|
||||
NSEnumerator * soundEnumerator;
|
||||
NSString * sound;
|
||||
NSMutableArray * directories = [NSMutableArray arrayWithObjects: @"/System/Library/Sounds", @"/Library/Sounds", nil];
|
||||
if ([NSApp isOnLeopardOrBetter])
|
||||
[directories addObject: [NSHomeDirectory() stringByAppendingPathComponent: @"Library/Sounds"]];
|
||||
|
||||
BOOL isDirectory;
|
||||
NSString * directory;
|
||||
NSEnumerator * enumerator = [directories objectEnumerator];
|
||||
while ((directory = [enumerator nextObject]))
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath: directory isDirectory: &isDirectory] && isDirectory)
|
||||
{
|
||||
soundEnumerator = [[[NSFileManager defaultManager] directoryContentsAtPath: directory] objectEnumerator];
|
||||
while ((sound = [soundEnumerator nextObject]))
|
||||
{
|
||||
sound = [sound stringByDeletingPathExtension];
|
||||
if ([NSSound soundNamed: sound])
|
||||
[sounds addObject: sound];
|
||||
}
|
||||
NSString * sound;
|
||||
NSEnumerator * soundEnumerator = [[[NSFileManager defaultManager] directoryContentsAtPath: directory] objectEnumerator];
|
||||
while ((sound = [soundEnumerator nextObject]))
|
||||
{
|
||||
sound = [sound stringByDeletingPathExtension];
|
||||
if ([NSSound soundNamed: sound])
|
||||
[sounds addObject: sound];
|
||||
}
|
||||
}
|
||||
|
||||
return sounds;
|
||||
|
|
Loading…
Add table
Reference in a new issue