mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-12 14:00:08 +02:00
👌 Move legacy .phpmon.conf.json to new path
This commit is contained in:
@@ -211,6 +211,7 @@ class Preferences {
|
|||||||
// MARK: - Custom Preferences
|
// MARK: - Custom Preferences
|
||||||
|
|
||||||
private func loadCustomPreferences() {
|
private func loadCustomPreferences() {
|
||||||
|
moveOutdatedConfigurationFile()
|
||||||
let url = URL(fileURLWithPath: "/Users/\(Paths.whoami)/.config/phpmon/config.json")
|
let url = URL(fileURLWithPath: "/Users/\(Paths.whoami)/.config/phpmon/config.json")
|
||||||
if Filesystem.fileExists(url.path) {
|
if Filesystem.fileExists(url.path) {
|
||||||
Log.info("A custom ~/.config/phpmon/config.json file was found. Attempting to parse...")
|
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) {
|
private func loadCustomPreferencesFile(_ url: URL) {
|
||||||
do {
|
do {
|
||||||
customPreferences = try JSONDecoder().decode(
|
customPreferences = try JSONDecoder().decode(
|
||||||
|
Reference in New Issue
Block a user