forked from MeloNX/MeloNX
Fix for updates and DLCs
This commit is contained in:
parent
5009474e14
commit
d48ad1b9ee
@ -132,6 +132,8 @@ struct DLCManagerSheet: View {
|
|||||||
private extension DLCManagerSheet {
|
private extension DLCManagerSheet {
|
||||||
static func loadDlc(_ game: Game) -> [DownloadableContentContainer] {
|
static func loadDlc(_ game: Game) -> [DownloadableContentContainer] {
|
||||||
let jsonURL = dlcJsonPath(for: game)
|
let jsonURL = dlcJsonPath(for: game)
|
||||||
|
|
||||||
|
try? FileManager.default.createDirectory(at: jsonURL.deletingLastPathComponent(), withIntermediateDirectories: true)
|
||||||
guard let data = try? Data(contentsOf: jsonURL),
|
guard let data = try? Data(contentsOf: jsonURL),
|
||||||
var result = try? JSONDecoder().decode([DownloadableContentContainer].self, from: data)
|
var result = try? JSONDecoder().decode([DownloadableContentContainer].self, from: data)
|
||||||
else { return [] }
|
else { return [] }
|
||||||
|
@ -164,6 +164,7 @@ struct UpdateManagerSheet: View {
|
|||||||
let defaultData: [String: Any] = ["selected": "", "paths": []]
|
let defaultData: [String: Any] = ["selected": "", "paths": []]
|
||||||
do {
|
do {
|
||||||
let newData = try JSONSerialization.data(withJSONObject: defaultData, options: .prettyPrinted)
|
let newData = try JSONSerialization.data(withJSONObject: defaultData, options: .prettyPrinted)
|
||||||
|
try FileManager.default.createDirectory(at: jsonURL.deletingLastPathComponent(), withIntermediateDirectories: true)
|
||||||
try newData.write(to: jsonURL)
|
try newData.write(to: jsonURL)
|
||||||
items = []
|
items = []
|
||||||
selectedItem = ""
|
selectedItem = ""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user