added -localizedName

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37801 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2014-04-18 20:03:31 +00:00
parent cdcb7a0310
commit ede27c3f8c
3 changed files with 25 additions and 0 deletions

View file

@ -1,3 +1,9 @@
2014-04-18 Richard Frith-Macdonald <rfm@gnu.org>
* Headers/Foundation/NSHost.h:
* Source/NSHost.m:
Add OSX 10.6 -localizedName method.
2014-04-12 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSRegularExpression.m: Check for bad range from ICU and

View file

@ -99,6 +99,14 @@ extern "C" {
*/
- (BOOL) isEqualToHost: (NSHost*) aHost;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6,GS_API_LATEST)
/**
* If the receiver is the currentHost, returns the default name of the
* computer, otherwise returns nil.
*/
- (NSString*) localizedName;
#endif
/**
* Return host name. Chosen arbitrarily if a host has more than one.
*/

View file

@ -577,6 +577,17 @@ myHostName()
return NO;
}
- (NSString*) localizedName
{
NSString *n = myHostName();
if (self != [NSHost hostWithName: n])
{
n = nil;
}
return n;
}
- (NSString*) name
{
return [_names anyObject];