AAPT2: Fix --output-to-dir
Without a FinishEntry call, the file_ wasn't being released, which
prevents another StartEntry from succeeding.
Bug: 68033366
Test: manual aapt2 link --output-to-dir -o outputDir
Test: Archive_test.cpp
Change-Id: I3b66266327163307a2e4c7f891f6ee76baf7fc10
diff --git a/tools/aapt2/format/Archive.cpp b/tools/aapt2/format/Archive.cpp
index d152a9c..41f01a0 100644
--- a/tools/aapt2/format/Archive.cpp
+++ b/tools/aapt2/format/Archive.cpp
@@ -103,7 +103,13 @@
return false;
}
}
- return !in->HadError();
+
+ if (in->HadError()) {
+ error_ = in->GetError();
+ return false;
+ }
+
+ return FinishEntry();
}
bool HadError() const override {
@@ -191,6 +197,7 @@
}
if (in->HadError()) {
+ error_ = in->GetError();
return false;
}