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:
Fred Kiefer 2002-09-25 22:56:08 +00:00
parent 738b50d740
commit 763151ecb9

View file

@ -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;