Search in sources :

Example 1 with FileMetadataSnapshot

use of org.gradle.internal.file.FileMetadataSnapshot in project gradle by gradle.

the class DefaultFileSystemSnapshotter method calculateDetails.

private FileSnapshot calculateDetails(File file) {
    String path = internPath(file);
    FileMetadataSnapshot stat = fileSystem.stat(file);
    switch(stat.getType()) {
        case Missing:
            return new MissingFileSnapshot(path, new RelativePath(true, file.getName()));
        case Directory:
            return new DirectoryFileSnapshot(path, new RelativePath(false, file.getName()), true);
        case RegularFile:
            return new RegularFileSnapshot(path, new RelativePath(true, file.getName()), true, fileSnapshot(file, stat));
        default:
            throw new IllegalArgumentException("Unrecognized file type: " + stat.getType());
    }
}
Also used : FileMetadataSnapshot(org.gradle.internal.file.FileMetadataSnapshot) RelativePath(org.gradle.api.file.RelativePath)

Aggregations

RelativePath (org.gradle.api.file.RelativePath)1 FileMetadataSnapshot (org.gradle.internal.file.FileMetadataSnapshot)1