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:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user