mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-07 20:10:08 +02:00
🐛 Workaround broken JSON file (AddSiteVC.swift:66)
This commit is contained in:
@ -73,7 +73,7 @@ class ValetSiteScanner: SiteScanner
|
||||
.contentsOfDirectory(atPath: path)
|
||||
|
||||
return entries.forEach {
|
||||
if let site = self.resolveSite(path: "\(path)/\($0))") {
|
||||
if let site = self.resolveSite(path: "\(path)/\($0)") {
|
||||
sites.append(site)
|
||||
}
|
||||
}
|
||||
|
@ -69,11 +69,14 @@ class Valet {
|
||||
let file = FileManager.default.homeDirectoryForCurrentUser
|
||||
.appendingPathComponent(".config/valet/config.json")
|
||||
|
||||
// TODO: (5.2) Fix loading of invalid JSON: do not crash the app
|
||||
config = try! JSONDecoder().decode(
|
||||
Valet.Configuration.self,
|
||||
from: try! String(contentsOf: file, encoding: .utf8).data(using: .utf8)!
|
||||
)
|
||||
do {
|
||||
config = try JSONDecoder().decode(
|
||||
Valet.Configuration.self,
|
||||
from: try String(contentsOf: file, encoding: .utf8).data(using: .utf8)!
|
||||
)
|
||||
} catch {
|
||||
Log.err(error)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -63,7 +63,9 @@ class AddSiteVC: NSViewController, NSTextFieldDelegate {
|
||||
return
|
||||
}
|
||||
|
||||
Shell.run("cd '\(path)' && \(Paths.valet) link '\(name)'", requiresPath: true)
|
||||
// Adding `valet links` is a workaround for Valet malforming the config.json file
|
||||
// TODO: I will have to investigate and report this behaviour if possible
|
||||
Shell.run("cd '\(path)' && \(Paths.valet) link '\(name)' && valet links", requiresPath: true)
|
||||
|
||||
self.dismissView(outcome: .OK)
|
||||
|
||||
|
Reference in New Issue
Block a user