From a091398027617d6212b59a031c4ffa4f0e06fed0 Mon Sep 17 00:00:00 2001 From: stopiccot Date: Wed, 4 Jun 2014 21:40:33 +0300 Subject: [PATCH] different iso files have different data1.cab location --- osx/osx-vcmibuilder/vcmibuilder/AppDelegate.m | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/osx/osx-vcmibuilder/vcmibuilder/AppDelegate.m b/osx/osx-vcmibuilder/vcmibuilder/AppDelegate.m index e2db503c0..12f37a453 100644 --- a/osx/osx-vcmibuilder/vcmibuilder/AppDelegate.m +++ b/osx/osx-vcmibuilder/vcmibuilder/AppDelegate.m @@ -206,7 +206,26 @@ // Extract [self showProgressText:@"Extracting game data using unshield..."]; - if ([self runTask:@"/unshield" withArgs:@[@"-d", tempDir, @"x", [cd1 stringByAppendingString:@"/_setup/data1.cab"]] withWorkingDir:tempDir withPipe:nil] != 0) { + + NSArray* knownLocations = @[ + @"/_setup/data1.cab", + @"/Autorun/Setup/data1.cab" + ]; + + bool success = false; + for (NSString* location in knownLocations) { + NSString* cabLocation = [cd1 stringByAppendingString:location]; + if ([[NSFileManager defaultManager] fileExistsAtPath:cabLocation]) { + int result = [self runTask:@"/unshield" withArgs:@[@"-d", tempDir, @"x", cabLocation] withWorkingDir:tempDir withPipe:nil]; + + if (result == 0) { + success = true; + break; + } + } + } + + if (!success) { return [self showErrorText:@"Failed to extract game data using unshield"]; }