mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 18:11:56 +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
73c54f7230
commit
371bc78eed
1 changed files with 29 additions and 0 deletions
|
@ -44,6 +44,35 @@ static NSDictionary *nsmapping = nil;
|
||||||
|
|
||||||
#define GSNDNAME @"GNUstepGSSoundServer"
|
#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
|
@protocol GSSoundSvr
|
||||||
|
|
||||||
- (BOOL)playSound:(id)aSound;
|
- (BOOL)playSound:(id)aSound;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue