diff options
Diffstat (limited to 'lib/libUPnP/Neptune/Source/System/Cocoa/NptCocoaEnviroment.mm')
-rw-r--r-- | lib/libUPnP/Neptune/Source/System/Cocoa/NptCocoaEnviroment.mm | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/lib/libUPnP/Neptune/Source/System/Cocoa/NptCocoaEnviroment.mm b/lib/libUPnP/Neptune/Source/System/Cocoa/NptCocoaEnviroment.mm new file mode 100644 index 0000000..bc0b8df --- /dev/null +++ b/lib/libUPnP/Neptune/Source/System/Cocoa/NptCocoaEnviroment.mm @@ -0,0 +1,40 @@ +/***************************************************************** +| +| Neptune - System Support: Cocoa Implementation +| +| (c) 2002-2006 Gilles Boccon-Gibod +| Author: Sylvain Rebaud (sylvain@rebaud.com) +| +****************************************************************/ + +/*---------------------------------------------------------------------- +| includes ++---------------------------------------------------------------------*/ +#include "NptConfig.h" +#include "NptSystem.h" + +#import <Foundation/Foundation.h> + +#if !defined(TARGET_OS_IPHONE) || !TARGET_OS_IPHONE +#import <SystemConfiguration/SystemConfiguration.h> +#else +#import <UIKit/UIKit.h> +#endif + +NPT_Result +NPT_GetSystemMachineName(NPT_String& name) +{ + // we need a pool because of UTF8String + NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; + +#if !defined(TARGET_OS_IPHONE) || !TARGET_OS_IPHONE + CFStringRef _name = SCDynamicStoreCopyComputerName(NULL, NULL); + name = [(NSString *)_name UTF8String]; + [(NSString *)_name release]; +#else + name = [[[UIDevice currentDevice] name] UTF8String]; +#endif + + [pool release]; + return NPT_SUCCESS; +} |