Make everything else work on Linux

This commit is contained in:
Sami Samhuri 2019-12-22 13:46:29 -08:00
parent 6a0db8febe
commit b28b52d75d
5 changed files with 8 additions and 3 deletions

View file

@ -72,7 +72,11 @@ final class JSONFeedWriter {
)
let encoder = JSONEncoder()
encoder.dateEncodingStrategy = .iso8601
#if os(Linux)
encoder.outputFormatting = [.prettyPrinted]
#else
encoder.outputFormatting = [.prettyPrinted, .withoutEscapingSlashes]
#endif
let feedJSON = try encoder.encode(feed)
let feedURL = targetURL.appendingPathComponent(jsonFeed.path)
try feedJSON.write(to: feedURL, options: [.atomic])

View file

@ -79,7 +79,7 @@ final class PostRepo {
return try fileManager.contentsOfDirectory(atPath: directory.path).flatMap { (filename: String) -> [URL] in
let fileURL = directory.appendingPathComponent(filename)
var isDir: ObjCBool = false
fileManager.fileExists(atPath: fileURL.path, isDirectory: &isDir)
_ = fileManager.fileExists(atPath: fileURL.path, isDirectory: &isDir)
if isDir.boolValue {
return try enumerateMarkdownFiles(directory: fileURL)
}

View file

@ -49,7 +49,7 @@ public final class SiteGenerator {
// Recurse into subdirectories, updating the target directory as well.
let fileURL = URL(fileURLWithPath: path).appendingPathComponent(filename)
var isDir: ObjCBool = false
fileManager.fileExists(atPath: fileURL.path, isDirectory: &isDir)
_ = fileManager.fileExists(atPath: fileURL.path, isDirectory: &isDir)
guard !isDir.boolValue else {
try renderPath(fileURL.path, to: targetURL.appendingPathComponent(filename))
continue

View file

@ -1,5 +1,7 @@
#!/bin/bash
set -euo pipefail
if [[ $(uname) = "Linux" ]]; then
build_platform_dir="x86_64-unknown-linux"
else

View file

@ -5,7 +5,6 @@
// Created by Sami Samhuri on 2019-12-01.
//
import Darwin
import Foundation
import samhuri_net