Archived
1
0
forked from MeloNX/MeloNX

Fix for updates and DLCs

This commit is contained in:
Daniil Vinogradov 2025-03-12 12:58:14 +01:00
parent 5009474e14
commit d48ad1b9ee
2 changed files with 3 additions and 0 deletions

View File

@ -132,6 +132,8 @@ struct DLCManagerSheet: View {
private extension DLCManagerSheet {
static func loadDlc(_ game: Game) -> [DownloadableContentContainer] {
let jsonURL = dlcJsonPath(for: game)
try? FileManager.default.createDirectory(at: jsonURL.deletingLastPathComponent(), withIntermediateDirectories: true)
guard let data = try? Data(contentsOf: jsonURL),
var result = try? JSONDecoder().decode([DownloadableContentContainer].self, from: data)
else { return [] }

View File

@ -164,6 +164,7 @@ struct UpdateManagerSheet: View {
let defaultData: [String: Any] = ["selected": "", "paths": []]
do {
let newData = try JSONSerialization.data(withJSONObject: defaultData, options: .prettyPrinted)
try FileManager.default.createDirectory(at: jsonURL.deletingLastPathComponent(), withIntermediateDirectories: true)
try newData.write(to: jsonURL)
items = []
selectedItem = ""