Create Dir in Makefile Instead
...of in the program.
Change-Id: I5276b8f582901d5688b29a18038c036135febafd
diff --git a/tools/build/test_executable.mk b/tools/build/test_executable.mk
index 5ed0e6f..b1889a8 100644
--- a/tools/build/test_executable.mk
+++ b/tools/build/test_executable.mk
@@ -32,6 +32,7 @@
$(cts_executable_xml): PRIVATE_EXECUTABLE := $(LOCAL_MODULE)
$(cts_executable_xml): $(addprefix $(LOCAL_PATH)/,$(LOCAL_SRC_FILES)) $(CTS_EXPECTATIONS) | $(CTS_NATIVE_TEST_SCANNER) $(CTS_XML_GENERATOR)
$(hide) echo Generating test description for native package $(PRIVATE_TEST_PACKAGE)
+ $(hide) mkdir -p $(CTS_NATIVE_XML_OUT)
$(hide) $(CTS_NATIVE_TEST_SCANNER) -s $(PRIVATE_PATH) | \
$(CTS_XML_GENERATOR) -n $(PRIVATE_EXECUTABLE) \
-p $(PRIVATE_TEST_PACKAGE) \
diff --git a/tools/cts-xml-generator/src/com/android/cts/xmlgenerator/NativeXmlGenerator.java b/tools/cts-xml-generator/src/com/android/cts/xmlgenerator/NativeXmlGenerator.java
index 746b4db..1692c10 100644
--- a/tools/cts-xml-generator/src/com/android/cts/xmlgenerator/NativeXmlGenerator.java
+++ b/tools/cts-xml-generator/src/com/android/cts/xmlgenerator/NativeXmlGenerator.java
@@ -63,14 +63,6 @@
OutputStream output = System.out;
if (mOutputPath != null) {
File outputFile = new File(mOutputPath);
- File outputDir = outputFile.getParentFile();
- if (!outputDir.exists()) {
- outputDir.mkdirs();
- if (!outputDir.exists()) {
- System.err.println("Couldn't make output directory: " + outputDir);
- System.exit(1);
- }
- }
output = new FileOutputStream(outputFile);
}
@@ -162,4 +154,3 @@
return expectationStore != null && expectationStore.get(testName) != Expectation.SUCCESS;
}
}
-