1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-08-07 20:10:08 +02:00

🐛 Prevent #61 from crashing the app

This commit is contained in:
2021-12-06 12:29:00 +01:00
parent bbb04f7907
commit 1159a6cc2e
2 changed files with 16 additions and 9 deletions

View File

@ -659,7 +659,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 80;
CURRENT_PROJECT_VERSION = 81;
DEVELOPMENT_TEAM = 8M54J5J787;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = phpmon/Info.plist;
@ -667,7 +667,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 4.0;
MARKETING_VERSION = 4.0.1;
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@ -683,7 +683,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 80;
CURRENT_PROJECT_VERSION = 81;
DEVELOPMENT_TEAM = 8M54J5J787;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = phpmon/Info.plist;
@ -691,7 +691,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 4.0;
MARKETING_VERSION = 4.0.1;
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";

View File

@ -11,7 +11,7 @@ import Foundation
class PhpInstallation {
var longVersion: String
var homebrewInfo: HomebrewPackage
var homebrewInfo: HomebrewPackage?
init(_ version: String) {
let phpConfigExecutablePath = "\(Paths.optPath)/php@\(version)/bin/php-config"
@ -24,10 +24,17 @@ class PhpInstallation {
}
let info = Shell.pipe("\(Paths.brew) info php@\(version) --json")
self.homebrewInfo = try! JSONDecoder().decode(
[HomebrewPackage].self,
from: info.data(using: .utf8)!
).first!
do {
let data = try JSONDecoder().decode(
[HomebrewPackage].self,
from: info.data(using: .utf8)!
)
self.homebrewInfo = data.first!
} catch {
print("There was an issue parsing Homebrew info for PHP \(version)")
self.homebrewInfo = nil
}
}
}