Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Swift 4.1 #1230

Merged
merged 3 commits into from Mar 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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