Errno.swift 383 B

1234567891011121314151617181920
  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 class Errno {
  14. public class func description() -> String {
  15. return String.fromCString(UnsafePointer(strerror(errno))) ?? "Error: \(errno)"
  16. }
  17. }