Errno.swift 378 B

123456789101112131415161718192021
  1. //
  2. // Errno.swift
  3. // Swifter
  4. //
  5. // Created by Damian Kolakowski on 13/07/16.
  6. // Copyright © 2016 Damian Kołakowski. All rights reserved.
  7. //
  8. #if os(Linux)
  9. import Glibc
  10. #else
  11. import Foundation
  12. #endif
  13. public struct Errno {
  14. public static var description: String {
  15. return String(cString: UnsafePointer(strerror(errno))) ?? "Error: \(errno)"
  16. }
  17. }