Skip to content

Commit

Permalink
replace appending(path:) with appendingPathComponent(_:)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandersandberg committed Apr 8, 2024
1 parent bf6fcea commit 97d9b4e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Sources/Main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func prepareAssets() async {
do {
let contentFiles = fileManager.walkDirectory(at: assetsDirectory)
for await contentFile in contentFiles {
try fileManager.copyItem(at: contentFile, to: outputDirectory.appending(path: contentFile.lastPathComponent))
try fileManager.copyItem(at: contentFile, to: outputDirectory.appendingPathComponent(contentFile.lastPathComponent))

if contentFile.pathExtension == "css" {
let cssString = try String(contentsOf: contentFile)
Expand Down
4 changes: 2 additions & 2 deletions Sources/Utils/String+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ extension String: LocalizedError {
}

func writeToOutputDirectory(path: String, prettyURL: Bool) throws {
let url = outputDirectory.appending(path: path)
let url = outputDirectory.appendingPathComponent(path)

let directory = prettyURL ? url : url.deletingLastPathComponent()
if !fileManager.fileExists(atPath: directory.path) {
try fileManager.createDirectory(at: directory, withIntermediateDirectories: true)
}

let file = if prettyURL {
url.appending(path: "index.html")
url.appendingPathComponent("index.html")
} else if !url.lastPathComponent.contains(".") {
url.appendingPathExtension("html")
} else {
Expand Down

0 comments on commit 97d9b4e

Please sign in to comment.