I'm checking this in.

This fixes a little fallout from Raif's patch.  When writing CNI
headers we want to call mkdirs() on the target header's full
directory, since CNI headers are put into a subdirectories of the -d
directory.

With this patch I can build the gcj-eclipse branch again.

Tom

2006-09-26  Tom Tromey  <[EMAIL PROTECTED]>

        * tools/gnu/classpath/tools/javah/Printer.java (Printer): Don't
        call mkdirs in output-directory case.
        (getPrintStream): Create output directory.
        * tools/gnu/classpath/tools/javah/Main.java (makeOutputDirectory):
        Don't call mkdirs.

Index: tools/gnu/classpath/tools/javah/Main.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/tools/gnu/classpath/tools/javah/Main.java,v
retrieving revision 1.4
diff -u -r1.4 Main.java
--- tools/gnu/classpath/tools/javah/Main.java   26 Sep 2006 20:47:09 -0000      
1.4
+++ tools/gnu/classpath/tools/javah/Main.java   26 Sep 2006 22:21:12 -0000
@@ -272,10 +272,7 @@
     if (outputDir == null)
       outputFile = new File(".");
     else
-      {
-        outputFile = new File(outputDir);
-        outputFile.mkdirs();
-      }
+      outputFile = new File(outputDir);
     return outputFile;
   }
 
Index: tools/gnu/classpath/tools/javah/Printer.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/tools/gnu/classpath/tools/javah/Printer.java,v
retrieving revision 1.2
diff -u -r1.2 Printer.java
--- tools/gnu/classpath/tools/javah/Printer.java        26 Sep 2006 20:47:09 
-0000      1.2
+++ tools/gnu/classpath/tools/javah/Printer.java        26 Sep 2006 22:21:12 
-0000
@@ -86,9 +86,7 @@
       throw new IllegalArgumentException("File argument MUST NOT be null");
     outputFileObject = outFile;
     isDirectory = isDir;
-    if (isDirectory)
-      outputFileObject.mkdirs();
-    else
+    if (! isDirectory)
       {
         File parent = outputFileObject.getParentFile();
         if (parent != null)
@@ -114,6 +112,9 @@
         File outFile = new File(outputFileObject, fullName);
         if (outFile.exists() && ! force)
           return null;
+        File parent = outFile.getParentFile();
+        if (parent != null)
+          parent.mkdirs();
         fos = new FileOutputStream(outFile);
         result = getPrintStreamImpl(fos, klass);
         writePreamble(result);

Reply via email to