Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CapacitorFilesystem.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ Pod::Spec.new do |s|
s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
s.ios.deployment_target = '15.0'
s.dependency 'Capacitor'
s.dependency 'IONFilesystemLib', spec='~> 2.0.0'
s.dependency 'IONFilesystemLib', spec='2.0.1'
s.swift_version = '5.1'
end
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0"),
.package(url: "https://github.com/ionic-team/ion-ios-filesystem.git", from: "2.0.0")
.package(url: "https://github.com/ionic-team/ion-ios-filesystem.git", exact: "2.0.1")
],
targets: [
.target(
Expand Down
4 changes: 2 additions & 2 deletions ios/Sources/FilesystemPlugin/FilesystemError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ enum IONFileMethod: String {
enum FilesystemError: Error {
case bridgeNotInitialised
case invalidInput(method: IONFileMethod)
case invalidPath(_ path: String)
case invalidPath(_ path: String, reason: Error? = nil)
case fileNotFound(method: IONFileMethod, _ path: String)
case directoryAlreadyExists(_ path: String)
case parentDirectoryMissing
Expand Down Expand Up @@ -46,7 +46,7 @@ private extension FilesystemError {
switch self {
case .bridgeNotInitialised: "Capacitor bridge isn't initialized."
case .invalidInput(let method): "The '\(method.rawValue)' input parameters aren't valid."
case .invalidPath(let path): "Invalid \(!path.isEmpty ? "'" + path + "' " : "")path."
case .invalidPath(let path, let reason): "Invalid \(!path.isEmpty ? "'" + path + "' " : "")path\(reason.map { ": \($0.localizedDescription)" } ?? ".")"
case .fileNotFound(let method, let path): "'\(method.rawValue)' failed because file\(!path.isEmpty ? " at '" + path + "' " : "") does not exist."
case .directoryAlreadyExists(let path): "Directory\(!path.isEmpty ? " at '" + path + "' " : "") already exists, cannot be overwritten."
case .parentDirectoryMissing: "Missing parent directory - possibly recursive=false was passed or parent directory creation failed."
Expand Down
8 changes: 4 additions & 4 deletions ios/Sources/FilesystemPlugin/FilesystemLocationResolver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ struct FilesystemLocationResolver {
}

private func resolveURL(path: String, directory: IONFILESearchPath) -> Result<URL, FilesystemError> {
return if let url = try? service.getFileURL(atPath: path, withSearchPath: directory) {
.success(url)
} else {
.failure(.invalidPath(path))
do {
return .success(try service.getFileURL(atPath: path, withSearchPath: directory))
} catch {
return .failure(.invalidPath(path, reason: error))
}
}
}
Loading