Merge pull request 'Fix for updates and DLCs' (#21) from XITRIX/MeloNX:updates-fix into XC-ios-ht

This commit is contained in:
Stossy11 2025-03-13 09:30:28 +11:00
parent a6b4f2d91f
commit 3207e1e739
3 changed files with 2 additions and 0 deletions

View File

@ -132,6 +132,7 @@ 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

@ -179,6 +179,7 @@ struct UpdateManagerSheet: View {
do {
let data = try Data(contentsOf: jsonURL)
try FileManager.default.createDirectory(at: jsonURL.deletingLastPathComponent(), withIntermediateDirectories: true)
var jsonDict = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] ?? [:]
if let currentSelected = jsonDict["selected"] as? String, currentSelected == newSelection {