Skip to content

Commit

Permalink
Minor fix for installing 86Box when it's not already installed
Browse files Browse the repository at this point in the history
  • Loading branch information
Moonif committed Feb 18, 2024
1 parent d34bbf3 commit 0381d43
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
4 changes: 2 additions & 2 deletions MacBox.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)";
MARKETING_VERSION = 0.4;
MARKETING_VERSION = 0.4.1;
PRODUCT_BUNDLE_IDENTIFIER = Moonif.MacBox;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -480,7 +480,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)";
MARKETING_VERSION = 0.4;
MARKETING_VERSION = 0.4.1;
PRODUCT_BUNDLE_IDENTIFIER = Moonif.MacBox;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
21 changes: 15 additions & 6 deletions MacBox/ViewControllers/MainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ class MainViewController: NSViewController {
private var currentVMConfigPath: String?
private let nameTextFieldMaxLimit: Int = 32
private let dragDropType = NSPasteboard.PasteboardType(rawValue: "private.table-row")
// HTTP request default values
private let httpHeaderAcceptValue = "application/vnd.github+json"
private let httpHeaderContentTypeValue = "application/json; charset=utf-8"
// 86Box emulator variables
private var emulatorAppVer: String = "0"
private var emulatorBuildVer: String = "0"
Expand Down Expand Up @@ -442,8 +445,8 @@ class MainViewController: NSViewController {
if let url = URL(string: "https://api.github.com/repos/86Box/86Box/releases/latest") {
var request = URLRequest(url: url)
request.httpMethod = "GET"
request.setValue("application/vnd.github+json", forHTTPHeaderField: "Accept")
request.setValue("application/json; charset=utf-8", forHTTPHeaderField: "Content-Type")
request.setValue(httpHeaderAcceptValue, forHTTPHeaderField: "Accept")
request.setValue(httpHeaderContentTypeValue, forHTTPHeaderField: "Content-Type")

let task = URLSession.shared.dataTask(with: request) {(data, response, error) in
guard let data = data else { return }
Expand Down Expand Up @@ -484,8 +487,8 @@ class MainViewController: NSViewController {
if let url = URL(string: "https://api.github.com/repos/86Box/roms/commits/master") {
var request = URLRequest(url: url)
request.httpMethod = "GET"
request.setValue("application/vnd.github+json", forHTTPHeaderField: "Accept")
request.setValue("application/json; charset=utf-8", forHTTPHeaderField: "Content-Type")
request.setValue(httpHeaderAcceptValue, forHTTPHeaderField: "Accept")
request.setValue(httpHeaderContentTypeValue, forHTTPHeaderField: "Content-Type")

let task = URLSession.shared.dataTask(with: request) {(data, response, error) in
guard let data = data else { return }
Expand Down Expand Up @@ -524,8 +527,8 @@ class MainViewController: NSViewController {
if let url = URL(string: "https://api.github.com/repos/Moonif/MacBox/releases/latest") {
var request = URLRequest(url: url)
request.httpMethod = "GET"
request.setValue("application/vnd.github+json", forHTTPHeaderField: "Accept")
request.setValue("application/json; charset=utf-8", forHTTPHeaderField: "Content-Type")
request.setValue(httpHeaderAcceptValue, forHTTPHeaderField: "Accept")
request.setValue(httpHeaderContentTypeValue, forHTTPHeaderField: "Content-Type")

let task = URLSession.shared.dataTask(with: request) {(data, response, error) in
guard let data = data else { return }
Expand Down Expand Up @@ -828,6 +831,12 @@ class MainViewController: NSViewController {
// Selected app version
var vmAppVersion = "net.86Box.86Box"
var vmAppArg = "-b"

if let emulatorAutoPath = versionInfoObject.emulatorAutoUrl?.path {
vmAppVersion = emulatorAutoPath
vmAppArg = "-a"
}

if let customAppPath = vmList[currentSelectedVM ?? 0].appPath {
if fileManager.fileExists(atPath: customAppPath) {
vmAppVersion = customAppPath
Expand Down

0 comments on commit 0381d43

Please sign in to comment.