-
Notifications
You must be signed in to change notification settings - Fork 1
IDirectory
IDirectory
class members.
Gets directory "absolute" path. It is the path the directory was originaly created with:
IFile projectsDir = "C:/Projects";
string path = projectDir.AbsolutePath; // path is C:/Projects
...or the path derived from parent directory:
IDirectory myProjectsDir = "C:/Projects/MyProject"
IDirectory src = myProjectsDir/"Src";
string path = src.AbsolutePath; // path is C:/Projects/MyProject/Src
There is an implicit to string
conversion operation that returns AbsolutePath
so the call to this property could be omited:
IDirectory myProjectsDir = "C:/Projects/MyProject"
IDirectory src = myProjectsDir/"Src";
string path = src; // path is C:/Projects/MyProject/Src
Gets the flag indicating whether the directory exists.
IFile artifacts = "C:/Projects/MyProject/Artifacts";
bool artifactsExists = artifacts.Exists;
Gets directory name without preceding path.
IFile artifacts = "C:/Projects/MyProject/Artifacts";
string dirName = artifacts.Name; // "Artifacts"
Gets parent directory object (IDirectory
).
Gets IEnumerable
of IDirectory
objects representing childs of current directory.
Gets FileList containing children files of current directory. Note that the list will contain only direct child files, not files from subdirectories. If you need all files from subdirectories use SearchFilesRecursively helper.
IDirectory artifacts = "C:/Projects/MyProject/Artifacts";
artifacts.Files.DeleteAll(); // will delete direct children
// files from Artifacts directory
artifacts.SearchFilesRecursively().DeleteAll(); // will delete all files including
// subdirectories
Creates the directory if it does not exist.
IFile artifacts = "C:/Projects/MyProject/Artifacts";
// creates C:/Projects/MyProject/Artifacts (if it does not exist) directory
artifacts.EnsureExists();
Deletes the directory.
Calclulates relative path from provided directory
to the current directory.
IFile file = "C:/A/B/file.txt";
IDirectory dir = "C:/A/D";
string relativeFilePath = file.GetRelativePath(dir); // "../B/file.txt"
Gets a IDirectory
object representing child of current dirrectory. It is functionally close to /
operator, but the difference is that GetDirectory
always returns IDirectory
while /
could return IFile
:
IDirectory dir = "C:/Projects";
IDirectory myProject1 = dir.GetDirectory("MyProject");
IDirectory myProject2 = dir/"MyProject";
// myProject1 and myProject2 are the same directories
Gets a IFile
object representing child file of current dirrectory. Just like GetDirectory
it could be used instead of /
operator:
IDirectory dir = "C:/Projects";
IFile myProject1 = dir.GetFile("MyProject.csproj");
IFile myProject2 = dir/"MyProject.csproj";
// myProject1 and myProject2 are the same files
Writing Tasks
- Creating a Workflow
- Defining Tasks
- Share State accross Tasks
- Mastering Dependencies
- Using result transformers
- Using Subflows to organize tasks
- Tasks Preconditions
- Recovering failure results
- Declaring dynamic tasks
- Creating Custom Tasks
Running Tasks
API
Tasklib