forked from MeloNX/MeloNX
Merge pull request 'Fix for updates and DLCs' (#21) from XITRIX/MeloNX:updates-fix into XC-ios-ht
This commit is contained in:
parent
a6b4f2d91f
commit
3207e1e739
Binary file not shown.
@ -132,6 +132,7 @@ 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 [] }
|
||||||
|
@ -179,6 +179,7 @@ struct UpdateManagerSheet: View {
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
let data = try Data(contentsOf: jsonURL)
|
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] ?? [:]
|
var jsonDict = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] ?? [:]
|
||||||
|
|
||||||
if let currentSelected = jsonDict["selected"] as? String, currentSelected == newSelection {
|
if let currentSelected = jsonDict["selected"] as? String, currentSelected == newSelection {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user