@capacitor/filesystem 8.1.4 → 8.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,6 +13,6 @@ Pod::Spec.new do |s|
13
13
  s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
14
14
  s.ios.deployment_target = '15.0'
15
15
  s.dependency 'Capacitor'
16
- s.dependency 'IONFilesystemLib', spec='~> 2.0.0'
16
+ s.dependency 'IONFilesystemLib', spec='2.0.1'
17
17
  s.swift_version = '5.1'
18
18
  end
package/Package.swift CHANGED
@@ -11,7 +11,7 @@ let package = Package(
11
11
  ],
12
12
  dependencies: [
13
13
  .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0"),
14
- .package(url: "https://github.com/ionic-team/ion-ios-filesystem.git", from: "2.0.0")
14
+ .package(url: "https://github.com/ionic-team/ion-ios-filesystem.git", exact: "2.0.1")
15
15
  ],
16
16
  targets: [
17
17
  .target(
@@ -16,7 +16,7 @@ enum IONFileMethod: String {
16
16
  enum FilesystemError: Error {
17
17
  case bridgeNotInitialised
18
18
  case invalidInput(method: IONFileMethod)
19
- case invalidPath(_ path: String)
19
+ case invalidPath(_ path: String, reason: Error? = nil)
20
20
  case fileNotFound(method: IONFileMethod, _ path: String)
21
21
  case directoryAlreadyExists(_ path: String)
22
22
  case parentDirectoryMissing
@@ -46,7 +46,7 @@ private extension FilesystemError {
46
46
  switch self {
47
47
  case .bridgeNotInitialised: "Capacitor bridge isn't initialized."
48
48
  case .invalidInput(let method): "The '\(method.rawValue)' input parameters aren't valid."
49
- case .invalidPath(let path): "Invalid \(!path.isEmpty ? "'" + path + "' " : "")path."
49
+ case .invalidPath(let path, let reason): "Invalid \(!path.isEmpty ? "'" + path + "' " : "")path\(reason.map { ": \($0.localizedDescription)" } ?? ".")"
50
50
  case .fileNotFound(let method, let path): "'\(method.rawValue)' failed because file\(!path.isEmpty ? " at '" + path + "' " : "") does not exist."
51
51
  case .directoryAlreadyExists(let path): "Directory\(!path.isEmpty ? " at '" + path + "' " : "") already exists, cannot be overwritten."
52
52
  case .parentDirectoryMissing: "Missing parent directory - possibly recursive=false was passed or parent directory creation failed."
@@ -30,10 +30,10 @@ struct FilesystemLocationResolver {
30
30
  }
31
31
 
32
32
  private func resolveURL(path: String, directory: IONFILESearchPath) -> Result<URL, FilesystemError> {
33
- return if let url = try? service.getFileURL(atPath: path, withSearchPath: directory) {
34
- .success(url)
35
- } else {
36
- .failure(.invalidPath(path))
33
+ do {
34
+ return .success(try service.getFileURL(atPath: path, withSearchPath: directory))
35
+ } catch {
36
+ return .failure(.invalidPath(path, reason: error))
37
37
  }
38
38
  }
39
39
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/filesystem",
3
- "version": "8.1.4",
3
+ "version": "8.1.5",
4
4
  "description": "The Filesystem API provides a NodeJS-like API for working with files on the device.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",