Package org.jnode.shell

Examples of org.jnode.shell.PathnamePattern


        String word = wordToken.getText();
        if (!PathnamePattern.isPattern(word)) {
            globbedWordTokens.add(wordToken);
            return;
        }
        PathnamePattern pattern = PathnamePattern.compilePathPattern(word);
        // Expand using the current directory as the base for relative path patterns.
        LinkedList<String> paths = pattern.expand(new File("."));
        // If it doesn't match anything, a pattern 'expands' to itself.
        if (paths.isEmpty()) {
            globbedWordTokens.add(wordToken);
        } else {
            for (String path : paths) {
View Full Code Here


                        dirs.add(file);
                    } else {
                        addFile(file);
                    }
                } else {
                    PathnamePattern pat = PathnamePattern.compilePathPattern(pattern);
                    List<String> list = pat.expand(new File("."));
                    for (String name : list) {
                        File file = new File(name);
                        if (file.isDirectory()) {
                            dirs.add(file);
                        } else {
View Full Code Here

                PathnamePattern.compilePathPattern("{print \\$1}", DF).toRegexString());
    }
   
    @Test
    public void testExpand() {
        PathnamePattern pat = PathnamePattern.compilePathPattern("/tmp/*");
        LinkedList<String> list = pat.expand(new File("."));
        for (String path : list) {
            Assert.assertTrue(new File(path).exists());
        }
        pat = PathnamePattern.compilePathPattern("*");
        list = pat.expand(new File("."));
        for (String path : list) {
            Assert.assertTrue(new File(path).exists());
        }
    }
View Full Code Here

TOP

Related Classes of org.jnode.shell.PathnamePattern

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.