grinder.files library Null safety

General file system routines, useful in the context of running builds. This includes the FileSet class, which is used for reasoning about sets of files.

Classes

FilePath
A class to make it easier to manipulate file system entites. Once paths or entites are converted into Paths, they can be easily copied, deleted, joined, and their name retrieved.
FileSet
A class to handle defining, composing, and comparing groups of files.

Functions

baseName(FileSystemEntity entity) String?
Return the first n - 1 segments of the file path.
copy(FileSystemEntity entity, Directory destDir, [GrinderContext? context]) → void
Copy the given entity to the destination directory.
copyDirectory(Directory srcDir, Directory destDir, [GrinderContext? context]) → void
Prefer using copy.
copyFile(File srcFile, Directory destDir, [GrinderContext? context]) → void
Prefer using copy.
delete(FileSystemEntity entity) → void
Delete the given file entity reference.
deleteEntity(FileSystemEntity entity, [GrinderContext? context]) → void
Prefer using delete.
fileExt(FileSystemEntity entity) String?
Return the file's extension without the period. This will return null if there is no extension.
fileName(FileSystemEntity entity) String
Return the last segment of the file path.
getDir(String path) Directory
Return the directory pointed to by the given path. This method converts the given path to a platform dependent path.
getFile(String path) File
Return the file pointed to by the given path. This method converts the given path to a platform dependent path.
joinDir(Directory dir, List<String> files) Directory
joinFile(Directory dir, List<String> files) File