We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 9432a20 + 6cf2852 commit 856eb09Copy full SHA for 856eb09
Foundation/NSPathUtilities.swift
@@ -10,6 +10,14 @@
10
import CoreFoundation
11
12
public func NSTemporaryDirectory() -> String {
13
+#if os(Windows)
14
+ let cchLength: DWORD = GetTempPathW(0, nil)
15
+ var wszPath: [WCHAR] = Array<WCHAR>(repeating: 0, count: Int(cchLength + 1))
16
+ guard GetTempPathW(DWORD(wszPath.count), &wszPath) == cchLength else {
17
+ precondition(false, "GetTempPathW mutation race")
18
+ }
19
+ return String(decodingCString: wszPath, as: UTF16.self)
20
+#else
21
#if canImport(Darwin)
22
var length: Int = confstr(_CS_DARWIN_USER_TEMP_DIR, nil, 0)
23
if length > 0 {
@@ -28,6 +36,7 @@ public func NSTemporaryDirectory() -> String {
28
36
}
29
37
30
38
return "/tmp/"
39
+#endif
31
40
32
41
33
42
extension String {
0 commit comments