1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-11-09 05:40:07 +01:00

👌 Make user-supplied apps available (#73)

This commit is contained in:
2022-01-04 00:20:47 +01:00
parent 9ef184331e
commit 7f320897be
4 changed files with 22 additions and 2 deletions

View File

@@ -14,7 +14,7 @@ import Foundation
class Application {
enum AppType {
case editor, browser, git_gui, terminal
case editor, browser, git_gui, terminal, user_supplied
}
/// Name of the app. Used for display purposes and to determine `name.app` exists.

View File

@@ -51,9 +51,15 @@ extension MainMenu {
Log.info("Setting up watchers...")
App.shared.handlePhpConfigWatcher()
// Detect applications (preset + custom)
Log.info("Detecting applications...")
// Attempt to load list of applications
App.shared.detectedApplications = Application.detectPresetApplications()
let customApps = Preferences.custom.scanApps.map { appName in
return Application(appName, .user_supplied)
}.filter { app in
return app.isInstalled()
}
App.shared.detectedApplications.append(contentsOf: customApps)
let appNames = App.shared.detectedApplications.map { app in
return app.name
}

View File

@@ -76,6 +76,10 @@ class Preferences {
return Self.shared.cachedPreferences
}
static var custom: CustomPrefs {
return Self.shared.customPreferences
}
/**
Determine whether a particular preference is enabled.
- Important: Requires the preference to have a corresponding boolean value, or a fatal error will be thrown.