mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-07 12:00:09 +02:00
👌 Move legacy .phpmon.conf.json to new path
This commit is contained in:
@ -211,6 +211,7 @@ class Preferences {
|
||||
// MARK: - Custom Preferences
|
||||
|
||||
private func loadCustomPreferences() {
|
||||
moveOutdatedConfigurationFile()
|
||||
let url = URL(fileURLWithPath: "/Users/\(Paths.whoami)/.config/phpmon/config.json")
|
||||
if Filesystem.fileExists(url.path) {
|
||||
Log.info("A custom ~/.config/phpmon/config.json file was found. Attempting to parse...")
|
||||
@ -220,6 +221,15 @@ class Preferences {
|
||||
}
|
||||
}
|
||||
|
||||
private func moveOutdatedConfigurationFile() {
|
||||
if Filesystem.fileExists("~/.phpmon.conf.json") && !Filesystem.fileExists("~/.config/phpmon/config.json") {
|
||||
Log.info("An outdated configuration file was found. Moving it...")
|
||||
Shell.run("mkdir -p ~/.config/phpmon")
|
||||
Shell.run("mv ~/.phpmon.conf.json ~/.config/phpmon/config.json")
|
||||
Log.info("The configuration file was moved successfully!")
|
||||
}
|
||||
}
|
||||
|
||||
private func loadCustomPreferencesFile(_ url: URL) {
|
||||
do {
|
||||
customPreferences = try JSONDecoder().decode(
|
||||
|
Reference in New Issue
Block a user