Skip to content

Commit

Permalink
Support Swift 4.1 (#1230)
Browse files Browse the repository at this point in the history
  • Loading branch information
djones6 committed Apr 5, 2018
1 parent 3d42897 commit 30b8d31
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Expand Up @@ -29,6 +29,14 @@ matrix:
- os: osx
osx_image: xcode9.2
sudo: required
- os: linux
dist: trusty
sudo: required
env: SWIFT_SNAPSHOT=swift-4.1-DEVELOPMENT-SNAPSHOT-2018-03-04-a
- os: osx
osx_image: xcode9.2
sudo: required
env: SWIFT_SNAPSHOT=swift-4.1-DEVELOPMENT-SNAPSHOT-2018-03-04-a

script:
- ./build.sh
12 changes: 6 additions & 6 deletions Sources/Kitura/staticFileServer/FileServer.swift
Expand Up @@ -91,10 +91,10 @@ extension StaticFileServer {
var isDirectory = ObjCBool(false)

if fileManager.fileExists(atPath: filePath, isDirectory: &isDirectory) {
#if os(Linux)
let isDirectoryBool = isDirectory
#else
#if !os(Linux) || swift(>=4.1)
let isDirectoryBool = isDirectory.boolValue
#else
let isDirectoryBool = isDirectory
#endif
serveExistingFile(filePath, requestPath: requestPath,
isDirectory: isDirectoryBool, response: response)
Expand Down Expand Up @@ -130,10 +130,10 @@ extension StaticFileServer {
private func serveIfNonDirectoryFile(atPath path: String, response: RouterResponse) -> Bool {
var isDirectory = ObjCBool(false)
if FileManager().fileExists(atPath: path, isDirectory: &isDirectory) {
#if os(Linux)
let isDirectoryBool = isDirectory
#else
#if !os(Linux) || swift(>=4.1)
let isDirectoryBool = isDirectory.boolValue
#else
let isDirectoryBool = isDirectory
#endif
if !isDirectoryBool {
serveNonDirectoryFile(path, response: response)
Expand Down

0 comments on commit 30b8d31

Please sign in to comment.