-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
80360e4
commit d123f40
Showing
5 changed files
with
60 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,20 @@ | ||
// swift-tools-version:4.1 | ||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "BluetoothLinux", | ||
targets: [ | ||
Target( | ||
name: "BluetoothLinux", | ||
_ = Package(name: "BluetoothLinux", | ||
products: [ | ||
.library( | ||
name: "BluetoothLinux", | ||
targets: ["BluetoothLinux"] | ||
) | ||
], | ||
dependencies: [ | ||
.Target(name: "CSwiftBluetoothLinux") | ||
]), | ||
Target( | ||
name: "CSwiftBluetoothLinux"), | ||
Target( | ||
name: "CSwiftBluetoothLinuxTest"), | ||
Target( | ||
name: "BluetoothLinuxTests", | ||
dependencies: [ | ||
.Target(name: "BluetoothLinux"), | ||
.Target(name: "CSwiftBluetoothLinuxTest") | ||
]) | ||
], | ||
dependencies: [ | ||
.Package(url: "https://github.com/PureSwift/Bluetooth.git", majorVersion: 2) | ||
] | ||
) | ||
.package(url: "https://github.com/PureSwift/Bluetooth.git", .branch("master")) | ||
], | ||
targets: [ | ||
.target(name: "BluetoothLinux", dependencies: ["Bluetooth", "CSwiftBluetoothLinux"]), | ||
.target(name: "CSwiftBluetoothLinux"), | ||
.target(name: "CSwiftBluetoothLinuxTest"), | ||
.testTarget(name: "BluetoothLinuxTests", dependencies: ["BluetoothLinux", "CSwiftBluetoothLinuxTest"]) | ||
], | ||
swiftLanguageVersions: [4]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// POSIXError.swift | ||
// SwiftFoundation | ||
// | ||
// Created by Alsey Coleman Miller on 7/22/15. | ||
// Copyright © 2015 PureSwift. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
internal extension POSIXError { | ||
|
||
/// Creates error from C ```errno```. | ||
static var fromErrno: POSIXError? { | ||
|
||
guard let code = POSIXError.Code(rawValue: POSIXError.Code.RawValue(errno)) | ||
else { return nil } | ||
|
||
return self.init(code: code) | ||
} | ||
|
||
/// Creates `POSIXError` from error code. | ||
init(code: POSIXError.Code) { | ||
|
||
let nsError = NSError( | ||
domain: NSPOSIXErrorDomain, | ||
code: Int(code.rawValue), | ||
userInfo: [ | ||
NSLocalizedDescriptionKey: String(cString: strerror(CInt(code.rawValue)), encoding: .ascii)! | ||
]) | ||
|
||
self.init(_nsError: nsError) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters