Skip to content

Commit

Permalink
Fixing logic bugs exposed by testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
ikeith committed Nov 10, 2020
1 parent b641606 commit e30e927
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ios/Capacitor/Capacitor/CAPInstanceDescriptor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ internal extension InstanceDescriptor {
@objc func _parseConfiguration(at capacitorURL: URL?, cordovaConfiguration cordovaURL: URL?) {
// sanity check that the app directory is valid
var isDirectory: ObjCBool = ObjCBool(false)
guard warnings.contains(.missingAppDir) == false, FileManager.default.fileExists(atPath: appLocation.path, isDirectory: &isDirectory) == true, isDirectory.boolValue == true else {
return
if warnings.contains(.missingAppDir) == false, (FileManager.default.fileExists(atPath: appLocation.path, isDirectory: &isDirectory) == false || isDirectory.boolValue == false) {
warnings.update(with: .missingAppDir)
}

// parse the capacitor configuration
var config: JSObject?
if let capacitorURL = capacitorURL, FileManager.default.fileExists(atPath: capacitorURL.path, isDirectory: &isDirectory) {
if let capacitorURL = capacitorURL, FileManager.default.fileExists(atPath: capacitorURL.path, isDirectory: &isDirectory), isDirectory.boolValue == false {
do {
let contents = try Data(contentsOf: capacitorURL)
config = JSTypes.coerceDictionaryToJSObject(try JSONSerialization.jsonObject(with: contents) as? [String: Any])
Expand All @@ -29,7 +29,7 @@ internal extension InstanceDescriptor {

// parse the cordova configuration
var configParser: XMLParser?
if let cordovaURL = cordovaURL, FileManager.default.fileExists(atPath: cordovaURL.path, isDirectory: &isDirectory) {
if let cordovaURL = cordovaURL, FileManager.default.fileExists(atPath: cordovaURL.path, isDirectory: &isDirectory), isDirectory.boolValue == false {
configParser = XMLParser(contentsOf: cordovaURL)
}
else {
Expand Down

0 comments on commit e30e927

Please sign in to comment.