-
Notifications
You must be signed in to change notification settings - Fork 102
Add enhanced support for multi-volume archives #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
84 commits
Select commit
Hold shift + click to select a range
b83ad8f
Excluded this branch from Travis, since it's only meant as a demo for…
abbeycode 2230b22
Added tests, headers, and stubs for multi-volume archives (PR #38)
abbeycode 9804c76
Merge branch 'v2.9' into multivolume
abbeycode 02aaf7c
Unexcluded multivolume branch from Travis
abbeycode f923d3e
Merged v2.9 into multivolume
abbeycode b8217c0
Synced upstream changes from v2.9 branch
abbeycode 96ad093
Fixed merge error
abbeycode 0415896
Added support for volume check
aonez 9196576
Improved detection of new format volume name scheme
aonez 2b143c1
Fixed nullable result
aonez 1061278
Excluded this branch from Travis, since it's only meant as a demo for…
abbeycode 124e167
Added tests, headers, and stubs for multi-volume archives (PR #38)
abbeycode c054bfe
Adapted to multivolume branch
aonez 8d3e7b0
Silenced two warnings caused by an update to unpack30.cpp (Issue #43)
abbeycode c0fd271
Ignoring analyzer issues for Unrar library files (Issue #43)
abbeycode 061c2f3
Replaced simulator ID with name, since duplicate simulators have been…
abbeycode 949a7fa
Switched from Travis-After-All to the officially supported Build Stag…
abbeycode 2e8dd20
Added release note [ci skip]
abbeycode 1feda29
Unexcluded multivolume branch from Travis
abbeycode 0a8591b
Rebased to multivolume branch
aonez ed799b3
Trying with .travis.yml from master
aonez f74850c
Revert "Trying with .travis.yml from master"
aonez 27eb8b2
Was at master, merging branch…
aonez 1f8a963
Implementing hasMultipleVolumes
aonez b1b86a1
Implementing isVolume methods
aonez 9d5e717
Implementing listVolumePaths
aonez 8586292
Improved firstVolumePath
aonez 9ce9134
Fixed wrong scape
aonez 844377e
Something that must be corrected
aonez 4a585be
Second dummy try…
aonez fa3139f
Removed isVolume
aonez 9a26401
Removed fileURL overloads
aonez 071d0bc
Unnecessary __block flag removed
aonez 5f96585
Using NSMutableSet to get unique paths faster
aonez b447aec
Printing hasMultipleVolumes error
aonez 50700ac
Opening first volume to list parts if needed
aonez 97a24bc
Comparing unordered volume lists
aonez 0f0e6ac
isVolume method removed
aonez e3c7718
Removing extra space
aonez 83683a1
Added macros for unified logging and activity tracing, and switched t…
abbeycode dcaf9c9
Added localization script, empty strings file, and wiring for resourc…
abbeycode 0f23417
Added support for NSProgress with cancellation to extraction methods,…
abbeycode 0060bc1
Added NSProgress+cancellation support to a couple more methods for wh…
abbeycode 560a631
Implemented NSProgressReporting protocol to make conformance more app…
abbeycode 9587b99
Added more details to extractFiles progress reporting, along with som…
abbeycode 99ff47c
Added progress reporting to performOnData, and additional documentati…
abbeycode b8b0baa
Whoops. Committed header changes for progress property
abbeycode 9786f81
Fixed documentation
abbeycode 3c4d1d2
Added reporting of URKFileInfo objects to progress reporting for extr…
abbeycode 65ffbba
Deprecated methods that take a progress block argument, and created v…
abbeycode 2144a1e
Fixed documentation
abbeycode ec31928
Moved ProgressReportingTests.m into place in the project
abbeycode 660b9b1
Updated documentation
abbeycode 5784477
Removed SWIFT_VERSION overrides, and specified 4.0 at the project level
abbeycode 09c21db
Fixed merge error
abbeycode ce1717e
Excluded this branch from Travis, since it's only meant as a demo for…
abbeycode b090e89
Added tests, headers, and stubs for multi-volume archives (PR #38)
abbeycode 13effa0
Adapted to multivolume branch
aonez 602bb90
Updated to RAR lib v5.5.5 (Issue #43)
abbeycode df360db
Updated Travis build to Xcode 8.3
abbeycode 3753993
Added release notes for 2.8.1 (Issue #43)
abbeycode d102983
Rebased to multivolume branch
aonez 61ac50b
Was at master, merging branch…
aonez b3b05ad
Implementing isVolume methods
aonez 53311f2
isVolume method removed
aonez 614f35f
Removing extra space
aonez 0f89b94
Rebase to @abbeycode multivolume branch
e83d7af
Fillet multivolume methods
7043e0d
Using new error method
8364d76
Using NSMutableOrderedSet for sorted array
8f4992e
Fixed bad travis config
e5d4743
Added newline break
41a6107
Removed unnecessary parenthesis
8231542
Checking first part on archive init
d129c73
Merge pull request #38 from aonez/master
abbeycode 8d70f06
Reduced public API surface area for multivolume archives
abbeycode 26149d0
Hardened regex code checking in +firstVolumeURL:
abbeycode f23e2ed
Added test to validate zero-padding in firstVolumeURL calculation for…
abbeycode be7a251
Cleaned up firstVolumeURL Part01 generation
abbeycode 41f7d88
Fixed some logging messages
abbeycode 9657b7e
Renamed some variables
abbeycode 7acfc7e
Synced upstream changes from 'v2.9' branch
abbeycode 07091c1
Added missing activity tracing [CI skip]
abbeycode 2bc269d
Added to changelog
abbeycode File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| // | ||
| // FirstVolumeTests.m | ||
| // UnrarKit | ||
| // | ||
| // Created by Dov Frankel on 2/9/17. | ||
| // | ||
| // | ||
|
|
||
| #import "URKArchiveTestCase.h" | ||
|
|
||
| @interface FirstVolumeTests : URKArchiveTestCase @end | ||
|
|
||
| @interface URKArchive (Tests) | ||
|
|
||
| // It's a private class method | ||
| + (NSURL *)firstVolumeURL:(NSURL *)volumeURL; | ||
|
|
||
| @end | ||
|
|
||
| @implementation FirstVolumeTests | ||
|
|
||
| - (void)testSingleVolume { | ||
| NSURL *onlyVolumeArchiveURL = self.testFileURLs[@"Test Archive.rar"]; | ||
| NSURL *returnedFirstVolumeURL = [URKArchive firstVolumeURL:onlyVolumeArchiveURL]; | ||
|
|
||
| XCTAssertNotNil(returnedFirstVolumeURL, @"No URL returned"); | ||
| XCTAssertEqualObjects(returnedFirstVolumeURL, onlyVolumeArchiveURL, @"URL changed even though it's a single volume archive"); | ||
| } | ||
|
|
||
|
|
||
| #if !TARGET_OS_IPHONE | ||
| - (void)testMultipleVolume_UseFirstVolume { | ||
| NSArray<NSURL*> *volumeURLs = [self multiPartArchiveWithName:@"FirstVolumeTests-testMultipleVolume_UseFirstVolume.rar"]; | ||
| NSURL *firstVolumeURL = volumeURLs.firstObject; | ||
| NSURL *returnedFirstVolumeURL = [URKArchive firstVolumeURL:firstVolumeURL]; | ||
|
|
||
| XCTAssertNotNil(returnedFirstVolumeURL, @"No URL returned"); | ||
| XCTAssertEqualObjects(returnedFirstVolumeURL, firstVolumeURL, @"URL changed even though it was initialized with the first volume"); | ||
| } | ||
| #endif | ||
|
|
||
| #if !TARGET_OS_IPHONE | ||
| - (void)testMultipleVolume_UseMiddleVolume { | ||
| NSArray<NSURL*> *volumeURLs = [self multiPartArchiveWithName:@"ListVolumesTests-testMultipleVolume_UseFirstVolume.rar"]; | ||
| NSURL *firstVolumeURL = volumeURLs.firstObject; | ||
| NSURL *thirdVolumeURL = volumeURLs[2]; | ||
|
|
||
| NSURL *returnedFirstVolumeURL = [URKArchive firstVolumeURL:thirdVolumeURL]; | ||
|
|
||
| XCTAssertNotNil(returnedFirstVolumeURL, @"No URL returned"); | ||
| XCTAssertEqualObjects(returnedFirstVolumeURL.absoluteString, firstVolumeURL.absoluteString, @"Incorrect URL returned as first volume"); | ||
| } | ||
| #endif | ||
|
|
||
| #if !TARGET_OS_IPHONE | ||
| - (void)testMultipleVolume_UseMiddleVolume_OneHundredParts { | ||
| NSArray<NSURL*> *volumeURLs = [self multiPartArchiveWithName:@"ListVolumesTests-testMultipleVolume_UseFirstVolume.rar" fileSize:2500000]; | ||
|
|
||
| NSURL *firstVolumeURL = volumeURLs.firstObject; | ||
| NSURL *hundredthVolumeURL = volumeURLs[100]; | ||
|
|
||
| NSURL *returnedFirstVolumeURL = [URKArchive firstVolumeURL:hundredthVolumeURL]; | ||
|
|
||
| XCTAssertNotNil(returnedFirstVolumeURL, @"No URL returned"); | ||
| XCTAssertEqualObjects(returnedFirstVolumeURL.absoluteString, firstVolumeURL.absoluteString, @"Incorrect URL returned as first volume"); | ||
| } | ||
| #endif | ||
|
|
||
| #if !TARGET_OS_IPHONE | ||
| - (void)testMultipleVolume_UseFirstVolume_OldNamingScheme { | ||
| NSArray<NSURL*> *volumeURLs = [self multiPartArchiveOldSchemeWithName:@"FirstVolumeTests-testMultipleVolume_UseFirstVolume_OldNamingScheme.rar"]; | ||
| NSURL *firstVolumeURL = volumeURLs.firstObject; | ||
| NSURL *returnedFirstVolumeURL = [URKArchive firstVolumeURL:firstVolumeURL]; | ||
|
|
||
| XCTAssertNotNil(returnedFirstVolumeURL, @"No URL returned"); | ||
| XCTAssertEqualObjects(returnedFirstVolumeURL, firstVolumeURL, @"URL changed even though it was initialized with the first volume"); | ||
| } | ||
| #endif | ||
|
|
||
| #if !TARGET_OS_IPHONE | ||
| - (void)testMultipleVolume_UseMiddleVolume_OldNamingScheme { | ||
| NSArray<NSURL*> *volumeURLs = [self multiPartArchiveOldSchemeWithName:@"FirstVolumeTests-testMultipleVolume_UseMiddleVolume_OldNamingScheme.rar"]; | ||
| NSURL *firstVolumeURL = volumeURLs.firstObject; | ||
| NSURL *thirdVolumeURL = volumeURLs[2]; | ||
|
|
||
| NSURL *returnedFirstVolumeURL = [URKArchive firstVolumeURL:thirdVolumeURL]; | ||
|
|
||
| XCTAssertNotNil(returnedFirstVolumeURL, @"No URL returned"); | ||
| XCTAssertEqualObjects(returnedFirstVolumeURL.absoluteString, firstVolumeURL.absoluteString, @"Incorrect URL returned as first volume"); | ||
| } | ||
| #endif | ||
|
|
||
| #if !TARGET_OS_IPHONE | ||
| - (void)testMultipleVolume_FirstVolumeMissing { | ||
| NSArray<NSURL*> *volumeURLs = [self multiPartArchiveWithName:@"ListVolumesTests-testMultipleVolume_FirstVolumeMissing.rar"]; | ||
|
|
||
| NSError *deleteError = nil; | ||
| [[NSFileManager defaultManager] removeItemAtURL:volumeURLs.firstObject | ||
| error:&deleteError]; | ||
| XCTAssertNil(deleteError, @"Error deleting first volume of archive"); | ||
|
|
||
| NSURL *firstVolumeURL = volumeURLs.firstObject; | ||
| NSURL *returnedFirstVolumeURL = [URKArchive firstVolumeURL:firstVolumeURL]; | ||
|
|
||
| XCTAssertNil(returnedFirstVolumeURL, @"First volume URL returned when it does not exist"); | ||
| } | ||
| #endif | ||
|
|
||
| @end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| // | ||
| // HasMultipleVolumesTests.m | ||
| // UnrarKit | ||
| // | ||
| // Created by Dov Frankel on 2/9/17. | ||
| // | ||
| // | ||
|
|
||
| #import "URKArchiveTestCase.h" | ||
|
|
||
| @interface HasMultipleVolumesTests : URKArchiveTestCase | ||
|
|
||
| @end | ||
|
|
||
| @implementation HasMultipleVolumesTests | ||
|
|
||
| - (void)testSingleVolume { | ||
| NSURL *testArchiveURL = self.testFileURLs[@"Test Archive.rar"]; | ||
| URKArchive *archive = [[URKArchive alloc] initWithURL:testArchiveURL error:nil]; | ||
|
|
||
| BOOL hasMultipleParts = archive.hasMultipleVolumes; | ||
|
|
||
| XCTAssertFalse(hasMultipleParts, @"Single-volume archive reported to have multiple parts"); | ||
| } | ||
|
|
||
| #if !TARGET_OS_IPHONE | ||
| - (void)testMultipleVolume_UseFirstVolume { | ||
| NSArray<NSURL*> *volumeURLs = [self multiPartArchiveWithName:@"HasMultipleVolumesTests-testMultipleVolume_UseFirstVolume.rar"]; | ||
| URKArchive *archive = [[URKArchive alloc] initWithURL:volumeURLs.firstObject error:nil]; | ||
|
|
||
| BOOL hasMultipleParts = archive.hasMultipleVolumes; | ||
| XCTAssertTrue(hasMultipleParts, @"Multi-volume archive's first part not reported to have multiple volumes"); | ||
| } | ||
| #endif | ||
|
|
||
| #if !TARGET_OS_IPHONE | ||
| - (void)testMultipleVolume_UseMiddleVolume { | ||
| NSArray<NSURL*> *volumeURLs = [self multiPartArchiveWithName:@"HasMultipleVolumesTests-testMultipleVolume_UseMiddleVolume.rar"]; | ||
| URKArchive *archive = [[URKArchive alloc] initWithURL:volumeURLs[2] error:nil]; | ||
|
|
||
| BOOL hasMultipleParts = archive.hasMultipleVolumes; | ||
| XCTAssertTrue(hasMultipleParts, @"Multi-volume archive's middle part not reported to have multiple volumes"); | ||
| } | ||
| #endif | ||
|
|
||
| #if !TARGET_OS_IPHONE | ||
| - (void)testMultipleVolume_UseFirstVolume_OldNamingScheme { | ||
| NSArray<NSURL*> *volumeURLs = [self multiPartArchiveOldSchemeWithName:@"HasMultipleVolumesTests-testMultipleVolume_UseFirstVolume_OldNamingScheme.rar"]; | ||
| URKArchive *archive = [[URKArchive alloc] initWithURL:volumeURLs.firstObject error:nil]; | ||
|
|
||
| BOOL hasMultipleParts = archive.hasMultipleVolumes; | ||
| XCTAssertTrue(hasMultipleParts, @"Multi-volume archive's first part not reported to have multiple volumes"); | ||
| } | ||
| #endif | ||
|
|
||
| #if !TARGET_OS_IPHONE | ||
| - (void)testMultipleVolume_UseMiddleVolume_OldNamingScheme { | ||
| NSArray<NSURL*> *volumeURLs = [self multiPartArchiveOldSchemeWithName:@"HasMultipleVolumesTests-testMultipleVolume_UseMiddleVolume_OldNamingScheme.rar"]; | ||
| URKArchive *archive = [[URKArchive alloc] initWithURL:volumeURLs[2] error:nil]; | ||
|
|
||
| BOOL hasMultipleParts = archive.hasMultipleVolumes; | ||
| XCTAssertTrue(hasMultipleParts, @"Multi-volume archive's middle part not reported to have multiple volumes"); | ||
| } | ||
| #endif | ||
|
|
||
| - (void)testInvalidArchive { | ||
| URKArchive *archive = [[URKArchive alloc] initWithURL:self.testFileURLs[@"Test File A.txt"] error:nil]; | ||
|
|
||
| BOOL hasMultipleParts = archive.hasMultipleVolumes; | ||
| XCTAssertFalse(hasMultipleParts, @"Invalid archive reported to have multiple volumes"); | ||
| } | ||
|
|
||
| @end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
finally you used the sort descriptor 😄