mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 15:11:37 +00:00
Moved method [NSBundle pathForSoundResource:] to here.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@14560 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
738b50d740
commit
763151ecb9
1 changed files with 29 additions and 0 deletions
|
@ -44,6 +44,35 @@ static NSDictionary *nsmapping = nil;
|
|||
|
||||
#define GSNDNAME @"GNUstepGSSoundServer"
|
||||
|
||||
@implementation NSBundle (NSSoundAdditions)
|
||||
|
||||
- (NSString *)pathForSoundResource:(NSString *)name
|
||||
{
|
||||
NSString *ext = [name pathExtension];
|
||||
NSString *path = nil;
|
||||
|
||||
if ((ext == nil) || [ext isEqualToString:@""])
|
||||
{
|
||||
NSArray *types = [NSSound soundUnfilteredFileTypes];
|
||||
unsigned c = [types count];
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; path == nil && i < c; i++)
|
||||
{
|
||||
ext = [types objectAtIndex: i];
|
||||
path = [self pathForResource: name ofType: ext];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
name = [name stringByDeletingPathExtension];
|
||||
path = [self pathForResource: name ofType: ext];
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@protocol GSSoundSvr
|
||||
|
||||
- (BOOL)playSound:(id)aSound;
|
||||
|
|
Loading…
Reference in a new issue