Implemented the "init(at: )" initialiser, the "pathString" computed property, and the "appendingPath(_: )" function for the URL+Extensions extension in the library target.
This commit is contained in:
@@ -54,25 +54,9 @@ public struct FileService: FileServicing {
|
||||
throw FileServiceError.urlNotFileURL
|
||||
}
|
||||
|
||||
let filePath = getPath(for: url)
|
||||
let filePath = url.pathString
|
||||
|
||||
return fileManager.fileExists(atPath: filePath)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Helpers
|
||||
|
||||
private extension FileService {
|
||||
|
||||
// MARK: Functions
|
||||
|
||||
func getPath(for url: URL) -> String {
|
||||
if #available(macOS 13.0, *) {
|
||||
return url.path()
|
||||
} else {
|
||||
return url.path
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user