| // Copyright 2015 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| #cgo CFLAGS: -x objective-c |
| #cgo LDFLAGS: -framework CoreFoundation -framework Foundation |
| #include <CoreFoundation/CFString.h> |
| #include <Foundation/NSPathUtilities.h> |
| CFStringRef path = (CFStringRef)NSTemporaryDirectory(); |
| CFStringGetCString(path, tmpdir, sizeof(tmpdir), kCFStringEncodingUTF8); |
| if Getenv("TMPDIR") != "" { |
| dir := C.GoString(C.loadtmpdir()) |
| if dir[len(dir)-1] == '/' { |