Skip to content

Commit

Permalink
Update JSONResource.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
rismay committed Jun 28, 2024
1 parent af0f10b commit 11d0037
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions Sources/WrkstrmFoundation/JSON/JSONResource.swift
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import Foundation
import WrkstrmMain

enum JSONResource {
static func load(fileName: String) -> Data? {
let currentFileURL = URL(fileURLWithPath: #file)
let currentDirectoryURL = currentFileURL.deletingLastPathComponent()

let fileURL =
extension WrkstrmMain.JSON {
public enum Resource {
static func load(fileName: String) -> Data? {
let currentFileURL = URL(fileURLWithPath: #file)
let currentDirectoryURL = currentFileURL.deletingLastPathComponent()

let fileURL =
currentDirectoryURL
.appendingPathComponent("Resources", isDirectory: true)
.appendingPathComponent(fileName)
.appendingPathExtension("json")

return try? Data(contentsOf: fileURL)
.appendingPathComponent("Resources", isDirectory: true)
.appendingPathComponent(fileName)
.appendingPathExtension("json")

return try? Data(contentsOf: fileURL)
}
}
}

0 comments on commit 11d0037

Please sign in to comment.