diff --git a/src/fr/devinsy/util/FileIterator.java b/src/fr/devinsy/util/FileIterator.java index 74192ef..244bba0 100644 --- a/src/fr/devinsy/util/FileIterator.java +++ b/src/fr/devinsy/util/FileIterator.java @@ -127,6 +127,8 @@ public class FileIterator extends Vector implements Iterator< this.removeAllElements(); this.add(firstState); } + + shift(); } @@ -198,7 +200,7 @@ public class FileIterator extends Vector implements Iterator< /** * */ - protected File currentFile() + public File currentFile() { File result; @@ -270,6 +272,8 @@ public class FileIterator extends Vector implements Iterator< { result = false; } + + //System.out.println("FOLLOWWWWW=[" + file.getPath() + "][" + this.followLinks + "][" + isLink(file) + "][" + result + "]"); } catch (Exception exception) { @@ -277,6 +281,8 @@ public class FileIterator extends Vector implements Iterator< result = false; } + + // return(result); } @@ -384,7 +390,8 @@ public class FileIterator extends Vector implements Iterator< int result; result = 0; - while (this.next() != null) + File f; + while ((f = this.next()) != null) { result += 1; } diff --git a/tests/FileIteratorTester.java b/tests/FileIteratorTester.java index 517da6c..3a20f84 100644 --- a/tests/FileIteratorTester.java +++ b/tests/FileIteratorTester.java @@ -43,7 +43,9 @@ public class FileIteratorTester try { - File f = new File("TestTree/DirectoryOne/titi2"); + //File f = new File("TestTree/DirectoryOne/titi2"); + //File f = new File("/home/cpm/.kde//cache-cpmstar"); + File f = new File("tests/TestTree/xine.jpg"); System.out.println("exists=" + f.exists()); System.out.println("canonical path = " + f.getCanonicalPath()); System.out.println("absolute path = " + f.getAbsolutePath()); @@ -58,10 +60,13 @@ public class FileIteratorTester System.out.println("----"); //FileIterator i = new FileIterator(new File("tests/TestTree")); + FileIterator i = new FileIterator(new File("tests/TestTree/xine.jpg"), null, true); + //FileIterator i = new FileIterator(new File("/home/cpm/.kde/cache-cpmstar"), ".*cache.*", false); //FileIterator i = new FileIterator(new File("tests/TestTree"), ".*dsc.*", false); //FileIterator i = new FileIterator(new File("/home/cpm/Images/Photos/")); - // FileIterator i = new FileIterator(new File("/home/cpm/Images/Photos/"), ".*\\.(JPG|jpg)", false); - FileIterator i = new FileIterator(new File("/home/cpm/Images/Photos/"), ".*anni_moi.*", false); + //FileIterator i = new FileIterator(new File("/home/cpm/Images/Photos/"), ".*\\.(JPG|jpg)", false); + //FileIterator i = new FileIterator(new File("/home/cpm/Images/Photos/"), ".*anni_moi.*", false); + while (i.hasNext()) { //System.out.println(i.toString());