Skip to content

Commit

Permalink
use xlibc
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-yuji committed Mar 6, 2017
1 parent 9ba46a7 commit d00b86e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 25 deletions.
5 changes: 4 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import PackageDescription

let package = Package(
name: "CKit"
name: "CKit",
dependencies: [
.Package(url: "https://github.com/michael-yuji/xlibc.git", majorVersion: 0)
]
)
6 changes: 1 addition & 5 deletions Sources/CKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,4 @@
// Copyright © 2017 Yuji. All rights reserved.
//

#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS)
@_exported import Darwin.C
#else
@_exported import Glibc
#endif
@_exported import xlibc
2 changes: 0 additions & 2 deletions Sources/Dirent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
//
//

import Foundation

#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS)
public typealias DirentRawType = Int32
#elseif os(Linux)
Expand Down
22 changes: 11 additions & 11 deletions Sources/FileInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import typealias Foundation.TimeInterval

public typealias cstat = CKit.stat

public enum FileStatusError: Error {
public enum FileInfoError: Error {
case searchPermissionDenied
case badFileDescriptor
case badAddress
Expand Down Expand Up @@ -154,26 +154,26 @@ public extension FileInfo {

switch err {
case EACCES:
throw FileStatusError.searchPermissionDenied
throw FileInfoError.searchPermissionDenied
case EBADF:
throw FileStatusError.badFileDescriptor
throw FileInfoError.badFileDescriptor
case EFAULT:
throw FileStatusError.badAddress
throw FileInfoError.badAddress
case ELOOP:
throw FileStatusError.tooManySymbolicLinksEncountered
throw FileInfoError.tooManySymbolicLinksEncountered
case ENAMETOOLONG:
throw FileStatusError.pathIs2Long
throw FileInfoError.pathIs2Long
case ENOENT:
throw FileStatusError.componentOfPathDoesNotExist
throw FileInfoError.componentOfPathDoesNotExist
case ENOMEM:
throw FileStatusError.outOfMemory
throw FileInfoError.outOfMemory
case ENOTDIR:
throw FileStatusError.componentOfPathIsNotDirectory
throw FileInfoError.componentOfPathIsNotDirectory
case EOVERFLOW:
throw FileStatusError.overflow
throw FileInfoError.overflow
case -1:
perror("stat")
throw FileStatusError.badAddress
throw FileInfoError.badAddress
default:
break
}
Expand Down
6 changes: 0 additions & 6 deletions Sources/System.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@
//
//

#if os(OSX) || os(iOS) || os(tvOS) || os(watchOS)
import Darwin
#else
import Glibc
#endif

#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS)
public typealias sys_conf_arg_t = Int32
#elseif os(Linux)
Expand Down

0 comments on commit d00b86e

Please sign in to comment.