Skip to content

Instantly share code, notes, and snippets.

@giovani-pereira-ifood
Last active March 26, 2021 19:56
Show Gist options
  • Save giovani-pereira-ifood/4b99a60633d945a25af76fb17f0ab749 to your computer and use it in GitHub Desktop.
Save giovani-pereira-ifood/4b99a60633d945a25af76fb17f0ab749 to your computer and use it in GitHub Desktop.
private func getReferenceFilePath() throws -> URL {
let fileURL = URL(fileURLWithPath: #file, isDirectory: false)
let referenceFileDirectotyURL = fileURL
.deletingLastPathComponent().deletingLastPathComponent()
.appendingPathComponent("ReferenceFolder")
let referenceFileURL = referenceFileDirectotyURL
.appendingPathComponent("referenceFile")
.appendingPathExtension("json")
guard FileManager.default.fileExists(atPath: referenceFileURL.path) else {
throw IconTestError.unableToFindFileAtReferencePath
}
return referenceFileURL
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment