Skip to content

Commit 598bb50

Browse files
committed
Ensure that the path always has a trailing slash
1 parent d5baea5 commit 598bb50

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Foundation/NSPathUtilities.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ public func NSTemporaryDirectory() -> String {
2424
}
2525
#endif
2626
if let tmpdir = NSProcessInfo.processInfo().environment["TMPDIR"] {
27-
return tmpdir
27+
if !tmpdir.hasSuffix("/") {
28+
return tmpdir + "/"
29+
} else {
30+
return tmpdir
31+
}
2832
}
2933
return "/tmp/"
3034
}
@@ -644,4 +648,4 @@ internal func _NSCleanupTemporaryFile(auxFilePath: String, _ filePath: String) t
644648
}
645649
throw _NSErrorWithErrno(errno, reading: false, path: filePath)
646650
}
647-
}
651+
}

0 commit comments

Comments
 (0)