You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlbeans.apache.org by ra...@apache.org on 2005/04/13 04:51:40 UTC

svn commit: r161146 - xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/SchemaCodeGenerator.java

Author: radup
Date: Tue Apr 12 19:51:39 2005
New Revision: 161146

URL: http://svn.apache.org/viewcvs?view=rev&rev=161146
Log:
Forgot a few lines of code in r161139.

Modified:
    xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/SchemaCodeGenerator.java

Modified: xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/SchemaCodeGenerator.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/SchemaCodeGenerator.java?view=diff&r1=161145&r2=161146
==============================================================================
--- xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/SchemaCodeGenerator.java (original)
+++ xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/SchemaCodeGenerator.java Tue Apr 12 19:51:39 2005
@@ -68,6 +68,15 @@
     {
         if (!(rootDir.isDirectory() && srcDir.isDirectory()))
             throw new IllegalArgumentException();
+        String absolutePath = srcDir.getAbsolutePath();
+        // Do a sanity check to make sure we don't delete by mistake some important dir
+        if (absolutePath.length() <= 5)
+            return;
+        if (absolutePath.startsWith("/home/") &&
+            (absolutePath.indexOf("/", 6) >= absolutePath.length() - 1 ||
+                absolutePath.indexOf("/", 6) < 0))
+            return;
+
         // Go recursively starting with srcDir and delete all files that are
         // not in the given Set
         File[] files = srcDir.listFiles();
@@ -79,10 +88,16 @@
                 ;
             else
             {
-                files[i].delete();
+                deleteXmlBeansFile(files[i]);
                 deleteDirRecursively(rootDir, files[i].getParentFile());
             }
         }
+    }
+
+    private static void deleteXmlBeansFile(File file)
+    {
+        if (file.getName().endsWith(".java"))
+            file.delete();
     }
 
     private static void deleteDirRecursively(File root, File dir)



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: commits-help@xmlbeans.apache.org