Skip to content

Commit

Permalink
fix: file exist issue
Browse files Browse the repository at this point in the history
  • Loading branch information
riderx committed Nov 25, 2021
1 parent 64f3a24 commit 4383cdd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions ios/Plugin/CapacitorUpdater.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ extension URL {
var isDirectory: Bool {
(try? resourceValues(forKeys: [.isDirectoryKey]))?.isDirectory == true
}
}
extension String {
var fileExists: Bool {
return FileManager().fileExists(atPath: self)
}
var exist: Bool {
return FileManager().fileExists(atPath: self.path)
}
}

@objc public class CapacitorUpdater: NSObject {
Expand Down Expand Up @@ -136,7 +134,7 @@ extension String {
let indexHot = destHot.appendingPathComponent("index.html")
let destHotPersist = libraryUrl.appendingPathComponent(basePathPersist).appendingPathComponent(version)
let indexPersist = destHot.appendingPathComponent("index.html")
if (destHot.isDirectory && destHotPersist.isDirectory && index.isFile && indexPersist.isFile) {
if (destHot.isDirectory && destHotPersist.isDirectory && indexHot.exist && indexPersist.exist) {
lastPathHot = destHot.path
lastPathPersist = destHotPersist.path
return true
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "capacitor-updater",
"version": "1.0.12",
"version": "1.0.13",
"license": "AGPL-3.0-only",
"description": "Download app update from url",
"main": "dist/plugin.cjs.js",
Expand Down

0 comments on commit 4383cdd

Please sign in to comment.