diff --git a/Natives/MinecraftResourceDownloadTask.m b/Natives/MinecraftResourceDownloadTask.m index a49588b8..7580aca8 100644 --- a/Natives/MinecraftResourceDownloadTask.m +++ b/Natives/MinecraftResourceDownloadTask.m @@ -86,8 +86,8 @@ void(^completionBlock)(void) = ^{ self.metadata = parseJSONFromFile(path); - if (self.metadata[@"NSErrorDescription"]) { - [self finishDownloadWithErrorString:self.metadata[@"NSErrorDescription"]]; + if (self.metadata[@"NSErrorObject"]) { + [self finishDownloadWithErrorString:[self.metadata[@"NSErrorObject"] localizedDescription]]; return; } if (self.metadata[@"inheritsFrom"]) { @@ -104,8 +104,8 @@ if (!version) { // This is likely local version, check if json exists and has inheritsFrom NSMutableDictionary *json = parseJSONFromFile(path); - if (json[@"NSErrorDescription"]) { - [self finishDownloadWithErrorString:json[@"NSErrorDescription"]]; + if (json[@"NSErrorObject"]) { + [self finishDownloadWithErrorString:[json[@"NSErrorObject"] localizedDescription]]; return; } else if (json[@"inheritsFrom"]) { version = (id)[MinecraftResourceUtils findVersion:json[@"inheritsFrom"] inList:remoteVersionList]; diff --git a/Natives/PLProfiles.m b/Natives/PLProfiles.m index 5dfe958f..e4e63c7d 100644 --- a/Natives/PLProfiles.m +++ b/Natives/PLProfiles.m @@ -64,7 +64,7 @@ static PLProfiles* current; self = [super init]; self.profilePath = [@(getenv("POJAV_GAME_DIR")) stringByAppendingPathComponent:@"launcher_profiles.json"]; self.profileDict = parseJSONFromFile(self.profilePath); - if (self.profileDict[@"NSErrorDescription"]) { + if (self.profileDict[@"NSErrorObject"]) { self.profileDict = PLProfiles.defaultProfiles; [self save]; } diff --git a/Natives/authenticator/BaseAuthenticator.m b/Natives/authenticator/BaseAuthenticator.m index 6253be31..4cbf3888 100644 --- a/Natives/authenticator/BaseAuthenticator.m +++ b/Natives/authenticator/BaseAuthenticator.m @@ -20,8 +20,8 @@ static BaseAuthenticator *current = nil; + (id)loadSavedName:(NSString *)name { NSMutableDictionary *authData = parseJSONFromFile([NSString stringWithFormat:@"%s/accounts/%@.json", getenv("POJAV_HOME"), name]); - if (authData[@"error"] != nil) { - NSError *error = ((NSError *)authData[@"error"]); + if (authData[@"NSErrorObject"] != nil) { + NSError *error = ((NSError *)authData[@"NSErrorObject"]); if (error.code != NSFileReadNoSuchFileError) { showDialog(localize(@"Error", nil), error.localizedDescription); } diff --git a/Natives/customcontrols/ControlLayout.m b/Natives/customcontrols/ControlLayout.m index dc551593..661545b5 100644 --- a/Natives/customcontrols/ControlLayout.m +++ b/Natives/customcontrols/ControlLayout.m @@ -27,8 +27,8 @@ NSString *controlFilePath = [NSString stringWithFormat:@"%s/controlmap/%@", getenv("POJAV_HOME"), name]; self.layoutDictionary = parseJSONFromFile(controlFilePath); - if (self.layoutDictionary[@"error"] != nil) { - showDialog(localize(@"Error", nil), [NSString stringWithFormat:@"Could not open %@: %@", controlFilePath, [self.layoutDictionary[@"error"] localizedDescription]]); + if (self.layoutDictionary[@"NSErrorObject"] != nil) { + showDialog(localize(@"Error", nil), [NSString stringWithFormat:@"Could not open %@: %@", controlFilePath, [self.layoutDictionary[@"NSErrorObject"] localizedDescription]]); return; } [self loadControlLayout:self.layoutDictionary]; diff --git a/Natives/utils.m b/Natives/utils.m index 021f3336..dfe51c57 100644 --- a/Natives/utils.m +++ b/Natives/utils.m @@ -68,14 +68,14 @@ NSMutableDictionary* parseJSONFromFile(NSString *path) { NSString *content = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:&error]; if (content == nil) { NSLog(@"[ParseJSON] Error: could not read %@: %@", path, error.localizedDescription); - return @{@"NSErrorDescription": error.localizedDescription}.mutableCopy; + return @{@"NSErrorObject": error}.mutableCopy; } NSData* data = [content dataUsingEncoding:NSUTF8StringEncoding]; NSMutableDictionary *dict = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&error]; if (error) { NSLog(@"[ParseJSON] Error: could not parse JSON: %@", error.localizedDescription); - return [@{@"error": error} mutableCopy]; + return @{@"NSErrorObject": error}.mutableCopy; } return dict; }