Author: rfelden
Date: Wed Jul  4 10:12:37 2007
New Revision: 3

URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D3&repname=3Df=
ix_create
Log:
minor update
no new features, few bugs fixed

Added:
    trunk/tools/src/test/java/org/jahia/tools/DiffToolsTest.java
Modified:
    trunk/fixcreator/src/main/java/org/jahia/fixcreator/controller/MyContro=
ller.java
    trunk/tools/src/main/java/org/jahia/tools/Tools.java

Modified: trunk/fixcreator/src/main/java/org/jahia/fixcreator/controller/My=
Controller.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/fixcreator/src/=
main/java/org/jahia/fixcreator/controller/MyController.java&rev=3D3&repname=
=3Dfix_create
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/fixcreator/src/main/java/org/jahia/fixcreator/controller/MyContro=
ller.java (original)
+++ trunk/fixcreator/src/main/java/org/jahia/fixcreator/controller/MyContro=
ller.java Wed Jul  4 10:12:37 2007
@@ -121,7 +121,7 @@
         try {
             File dir =3D new File(Application.APP_DIR, getProperty("app.co=
nfigDirectory")) ;
             m_settings.loadSettings(project);
-            File xmlfile =3D new File(dir, File.separator+project+".xml") ;
+            File xmlfile =3D new File(dir, project+".xml") ;
             setConfiguration(xmlfile);
         } catch (IOException e) {
             e.printStackTrace();
@@ -1069,6 +1069,7 @@
     /**
      * Add highlighted files to the patch files. This is automatic, aims a=
t saving clicking time.
      * TODO optimize this, no complete tree parsing required...
+     * TODO add also all the files contained in a new folder
      *
      * @param paths the paths to add
      * @param fileToCheck the file if it should be added

Modified: trunk/tools/src/main/java/org/jahia/tools/Tools.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/tools/src/main/=
java/org/jahia/tools/Tools.java&rev=3D3&repname=3Dfix_create
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/tools/src/main/java/org/jahia/tools/Tools.java (original)
+++ trunk/tools/src/main/java/org/jahia/tools/Tools.java Wed Jul  4 10:12:3=
7 2007
@@ -330,4 +330,21 @@
         return true ;
     }
 =

+    /**
+     * Delete a folder no matter what is contained inside.
+     * @param folder the folder to delete
+     */
+    public static void recDel(File folder) {
+        if (folder.isDirectory()) {
+            File[] files =3D folder.listFiles() ;
+            for (File file : files) {
+                recDel(file);
+                System.out.println(file.getName() + " deleted") ;
+            }
+        }
+        if (folder.delete())
+                System.out.println(folder.getName() + " deleted") ;
+        =

+    }
+
 }

Added: trunk/tools/src/test/java/org/jahia/tools/DiffToolsTest.java
URL: https://svndev.jahia.net/websvn/filedetails.php?path=3D/trunk/tools/sr=
c/test/java/org/jahia/tools/DiffToolsTest.java&rev=3D3&repname=3Dfix_create
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/tools/src/test/java/org/jahia/tools/DiffToolsTest.java (added)
+++ trunk/tools/src/test/java/org/jahia/tools/DiffToolsTest.java Wed Jul  4=
 10:12:37 2007
@@ -0,0 +1,53 @@
+package org.jahia.tools;
+
+import junit.framework.TestCase;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * @author Romain Felden
+ * @version 2007-06-22
+ */
+public class DiffToolsTest extends TestCase {
+
+    public void testGetFormattedModifications() {
+        try {
+            File check =3D new File("check") ;
+            check.mkdirs() ;
+
+            File oldRoot =3D new File(check, "old") ;
+            oldRoot.mkdir() ;
+            File oldFolderOne =3D new File(oldRoot, "one") ;
+            oldFolderOne.mkdir() ;
+            File oldFileOne =3D new File(oldFolderOne, "oneFile") ;
+            oldFileOne.createNewFile() ;
+
+            File newRoot =3D new File(check, "new") ;
+            newRoot.mkdir() ;
+            File newFolderOne =3D new File(newRoot, "one") ;
+            newFolderOne.mkdir() ;
+            File newFileOne =3D new File(newFolderOne, "oneFile") ;
+            newFileOne.createNewFile() ;
+            File newFileOneBis =3D new File(newFolderOne, "oneFileBis") ;
+            newFileOneBis.createNewFile() ;
+            File newFolderTwo =3D new File(newFolderOne, "two") ;
+            newFolderTwo.mkdir() ;
+            File newFileTwo =3D new File(newFolderTwo, "twoFile") ;
+            newFileTwo.createNewFile() ;
+
+            ChangeLists changes =3D DiffTools.getFormattedModifications(ol=
dRoot, newRoot) ;
+
+            String[] paths =3D changes.getAddedOrModifiedPaths() ;
+            for (String path : paths)
+            System.out.println(path) ;
+
+            Tools.recDel(check);
+            //Tools.recDel(check) ;
+
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+}

_______________________________________________
cvs_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list

Reply via email to