Package org.gradle.api.file

Examples of org.gradle.api.file.RelativePath


    private Matcher<Spec<RelativePath>> matchesFile(String... paths) {
        return matches(new RelativePath(true, paths));
    }

    private Matcher<Spec<RelativePath>> matchesDir(String... paths) {
        return matches(new RelativePath(false, paths));
    }
View Full Code Here


    @Test
    public void plainCopy() {
        visitor.startVisit(action(destDir));

        visitor.visitDir(file(new RelativePath(false)));

        visitor.visitFile(file(new RelativePath(true, "rootfile.txt"), new File(destDir, "rootfile.txt")));

        RelativePath subDirPath = new RelativePath(false, "subdir");
        visitor.visitDir(file(subDirPath));

        visitor.visitFile(file(new RelativePath(true, "subdir", "anotherfile.txt"), new File(destDir, "subdir/anotherfile.txt")));
    }
View Full Code Here

            this.parent = parent;
        }

        public RelativePath getRelativePath() {
            if (parent == null) {
                return new RelativePath(isFile);
            } else {
                return parent.getRelativePath().append(isFile, name);
            }
        }
View Full Code Here

    @Test
    public void transformsLastSegmentOfPath() {
        context.checking(new Expectations() {{
            allowing(details).getRelativePath();
            will(returnValue(new RelativePath(true, "a", "b")));
            one(transformer).transform("b");
            will(returnValue("c"));
            one(details).setRelativePath(new RelativePath(true, "a", "c"));
        }});

        action.execute(details);
    }
View Full Code Here

        AtomicBoolean stopFlag = new AtomicBoolean();
        if (root.exists()) {
            if (root.isFile()) {
                processSingleFile(root, stopFlag);
            } else {
               walkDir(root, new RelativePath(false), stopFlag);
            }
        } else {
            logger.info("file or directory '"+startFile.toString()+"', not found");
        }
    }
View Full Code Here

            logger.info("file or directory '"+startFile.toString()+"', not found");
        }
    }

    private void processSingleFile(File file, AtomicBoolean stopFlag) {
        RelativePath path = new RelativePath(true, file.getName());
        FileVisitDetailsImpl details = new FileVisitDetailsImpl(file, path, stopFlag);
        if (isAllowed(details)) {
            visitor.visitFile(details);
        }
    }
View Full Code Here

        }
        List<FileVisitDetailsImpl> dirs = new ArrayList<FileVisitDetailsImpl>();
        for (int i = 0; !stopFlag.get() && i < children.length; i++) {
            File child = children[i];
            boolean isFile = child.isFile();
            RelativePath childPath = path.append(isFile, child.getName());
            FileVisitDetailsImpl details = new FileVisitDetailsImpl(child, childPath, stopFlag);
            if (isAllowed(details)) {
                if (isFile) {
                    visitor.visitFile(details);
                } else {
View Full Code Here

                throw new UncheckedIOException(e);
            }
        }

        public RelativePath getRelativePath() {
            return new RelativePath(!entry.isDirectory(), entry.getName().split("/"));
        }
View Full Code Here

            }
        }

        public RelativePath getRelativePath()
        {
            return new RelativePath(!entry.isDirectory(), entry.getName().split("/"));
        }
View Full Code Here

        assertEquals(isFile, path.isFile());
    }

    @Test
    public void testConstructors() {
        RelativePath path;
        path = new RelativePath(true, "one");
        assertPathContains(path, true, "one");

        path = new RelativePath(false, "one", "two");
        assertPathContains(path, false, "one", "two");
    }
View Full Code Here

TOP

Related Classes of org.gradle.api.file.RelativePath

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.