blob: bc0b8df32d12f7c37c189257b4f1a6765c9c6355 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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;
}
|