jdk/test/tools/pack200/Utils.java
changeset 17490 46864558d068
parent 16050 1eee624cddb3
child 18594 b6a3c9f71ac8
--- a/jdk/test/tools/pack200/Utils.java	Thu May 16 10:58:20 2013 -0700
+++ b/jdk/test/tools/pack200/Utils.java	Wed May 15 18:26:16 2013 -0700
@@ -32,6 +32,7 @@
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.PrintStream;
+import java.nio.charset.Charset;
 import java.nio.file.Files;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -45,6 +46,7 @@
 import java.util.zip.ZipFile;
 
 import static java.nio.file.StandardCopyOption.*;
+import static java.nio.file.StandardOpenOption.*;
 
 /**
  *
@@ -70,6 +72,7 @@
     static final String JAR_FILE_EXT    = ".jar";
 
     static final File   TEST_SRC_DIR = new File(System.getProperty("test.src"));
+    static final File   TEST_CLS_DIR = new File(System.getProperty("test.classes"));
     static final String VERIFIER_DIR_NAME = "pack200-verifier";
     static final File   VerifierJar = new File(VERIFIER_DIR_NAME + JAR_FILE_EXT);
 
@@ -86,6 +89,10 @@
             return;
         }
         File srcDir = new File(TEST_SRC_DIR, VERIFIER_DIR_NAME);
+        if (!srcDir.exists()) {
+            // if not available try one level above
+            srcDir = new File(TEST_SRC_DIR.getParentFile(), VERIFIER_DIR_NAME);
+        }
         List<File> javaFileList = findFiles(srcDir, createFilter(JAVA_FILE_EXT));
         File tmpFile = File.createTempFile("javac", ".tmp");
         File classesDir = new File("xclasses");
@@ -205,6 +212,10 @@
                 : name;
 
     }
+   static void createFile(File outFile, List<String> content) throws IOException {
+        Files.write(outFile.getAbsoluteFile().toPath(), content,
+                Charset.defaultCharset(), CREATE_NEW, TRUNCATE_EXISTING);
+    }
 
     /*
      * Suppose a path is provided which consists of a full path