Bee.BeeDriver
BeeDriver is a tool that lets one setup and control external bee graphs. Unity uses this for script compilation.
You are supposed to bring your own prebuilt buildprogram that can create bee DAG .json files. BeeDriver will invoke
your buildprogram whenever it has no previous dag.json graph, or when the bee backend (currently tundra2.exe) has reason to
believe the previous dag.json file is no longer reliable.
Once you supply your buildprogram, you can call beeDriver.Build(), or beeDriver.BuildAsync(), and when at
some point bee is done building, you get back an BeeDriverResult result that has results of all individual nodes that were built.
It is up to the user of BeeDriver to parse those results.
It is common to want to share some data between the user of BeeDriver and the build program. You can use the .InputData.Add()
facility to help with this. The data you pass in will be serialized into a json file that is easy for the buildprogram to consume. Unity
uses this to inform the buildprogram about things like playersettings.
BeeDriver exposes several extension points. You can supply your own implementation of ProgressAPI, which wll be invoked
(on a thread) in realtime as nodes are building.
You can supply your own SourceFileUpdaterBase. The Unity script updater is an example of this. Each SourceFileUpdaterBase gets
to take a look at output from nodes and say if it thinks it can fix any problems. If so, it will be run.
The last extension point is the SourceFileUpdatersResultHandler. Here you have to provide an implementation that is responsible
for doing something with the results of the source file updaters. In Unity's case this is not trivial: to overwrite files it
has to ask the VCS integration to make files readable. It has to ask for consent for the user. If the files live in an immutable package,
it needs to let packman know it will be overwriting some files. Unity's usage of BeeBriver provides an implementation of SourceFileUpdatersResultHandler
that does all this.
The location of the dag json file used by the build
Entrypoint for the BeeDriver. Once you construct it, invoke .Add(), .Build() or .BuildAsync()
The buildprogram that should be used. Typically one would use a SystemProcessRunnableProgram here.
Which tundra backend program to use.
The root directory for the build graph. Typically this matches the Unity's project folder.
The name of the dag to use. Choose different dag names if you have different configurations that user will switch between.
Directory where to store the buildstate files.
A list of SourceFileUpdaters to use for this BeeDriver.
An implementation that can take care of handling the results of the sourcefile updaters.
An implementation that will be notified on a thread, in realtime, of the progress of the build.
If set to false the bee driver will stop as quickly as possible once a single node has failed.
Path to write a chrome://tracing style profiler output file for the build.
The process name to report in the profiler output file
Use DataForBuildProgram to write c# objects to disk that can be conveniently read from your buildprogram.
Use DataFromBuildProgram to read c# objects from disk that have been written by the buildprogram.
This builds the given targetname, and will only return when a buildresult is ready.
the name of a target in the buildgraph generated by the buildprogram
The BeeDriverResult for this build
This builds all targets, and will only return when a buildresult is ready.
The BeeDriverResult for this build
Block until the result of the currently active build is ready.
The BeeDriverResult for the currently active build
Start a build, and immediately return. You can periodically invoke .Tick() to see if the build is already finished.
Start a build, and immediately return. You can periodically invoke .Tick() to see if the build is already finished.
the name of a target in the buildgraph generated by the buildprogram
Use Tick() to periodically check if the currently active build is already finished.
Will return null if the build is not finished, otherwise will return the BeeDriverResult of the active build
Cancel build. This does not abort the build immediately but rather gracefully shuts down the build.
Users should keep calling Tick() until a result is returned.
Calling Dispose will abort any currently active build. This might not be immediate as the backend process that might be running could require a bit of time
to finish currently in-flight nodes as well as write out some bookkeeping data files.
Finalizer. A safety mechinism to make sure all resources are cleaned up even if .Dispose is not called.
A data object holding information related to the result of a build
An array of all the nodeResults for all nodes that have executed as part of the build
Whether or not the build was successful.
Messages that are not about individual nodes, but about BeeDriver specific things that have to be communicated. Things like
a buildprogram throwing an exception. A script updater not producing any results when it promised to do so. The backend crashing.
A Message that is not about individual nodes, but about BeeDriver specific things that have to be communicated. Things like
a buildprogram throwing an exception. A script updater not producing any results when it promised to do so. The backend crashing.
Constructor
The text payload of the message
Wether the message is a warning or an error
string representation of the message
text summary of the success status and all beedriver messages.
Warning/Error enum for BeeDrivermessage
It was a warning
It was an error
base class for various messages that can appear in a bee backend log
the message payload
Results from the bee backend about a specific node having been executed.
the annotation of the dag node
Human-readable description of what this node does for showing in progress bars
or other UI elements.
the stdout of the action that was run
the first outputfile of the node
the first output directory if any of the node
the exitcode the action finished with
this corresponds to the first number in the [20/3043] messages that you see in normal bee output.
The total number of nodes ever queued. Beware that this number is not constant. It is guaranteed to never decrease.
The commandline of this node. will only be filled in when the node failed.
The response files used by this node. will only be filled in when the node failed.
If this node had a profileroutput set it will be reported here
When using a BeeDriver, you can pass in a class derived from ProgressAPI to be notified of the progress of a running build. Beware
that these progress notifications will be delivered on a background thread. They are guaranteed to come from the same thread, but you
have to take care of data-synchronization with your mainthread yourself.
Override this method. The object it returns will receive the Report invocations for this build.
Derive from ProgressToken your own class that has the logic you want to happen on progress notifications.
This overload of Report is called for phase-changing messages. things like "running buildprogram". "running scriptupdater".
the message payload
This overload of Report is called for each node that finished running.
nodeResult is a dataobject that has a lot of detail about the node that just finished running
ReportNodeStarted is called for each node that starts running.
nodeResult is a dataobject that has a lot of detail about the node that just started running
Finish will be called when the build has finished.
Abstraction of runnable programs that makes it easy to test different bee driver components against fake external programs that we can easily make crash / do uncommon things
Start should start this runnable program, and return a RunningProgram derived object.
StartImpl will be invoked when the user invokes Start()
Abstraction layer for running programs.
Constructor
Whether or not this running program has exited
This method should return wether or not your runningprogram has exited.
The exitcode this running program exited with
The name by which to refer to this program in log messages
The combined stdout/stderr output of the running program that has exited
Will return when the program has exited.
Aborts this running program
AbortImpl will be invoked when the user wants to abort this process
Will close the standard input stream to the process. This can be used as a cross platform mechanism to signal "your host would like you to stop running now".
CloseStandardInputImpl will be invoked when the user invokes CloseStandardInput()
Implement this base class to plug in a facility like the Unity script updater that is able to modify original source files based on compiler errors/warnings.
Implement this method to return a Task specific to your implementation that represents an ongoing process that will produce updated files.
If the updater does not have anything to update, it's supposed to return null.
The node result to analyze. typically you would look into the .stdout property.
The beeDriver doing the build.
///
The base type that should be used for what your SourceFileUpdaterBase implementation returns from StartIfYouCanFixProblemsInTheseMessages
Constructor
The noderesult this task will attempt to fix
If we should produce an error if no updates are produced. Set this to false if you're not sure ahead of time if your updater will be able to fix the problem.
Whether or not this currently running updater is finished
Block until the sourcefile updater finished
The noderesult that has the failure this updater is trying to fix
If we should produce an error if no updates are produced. Set this to false if you're not sure ahead of time if your updater will be able to fix the problem.
The results of the running of this sourcefile updater
Invoking Abort will stop the running source updating proces as soon as possible
Data about the results of running a sourcefile updater.
Returns the produced updates by this sourcefile updater.
Returns the list of messages for this sourcefile updater. Use this to communciate errors/warnings that happened as part of the updating.
A type that represents a single update the sourcefile updater has produced
the original file that had the error the sourcefileupdater knows how to fix
the actual fixed content to be applied to the original file with error.
Implementors of this base class are responsible for applying the results of all the source file updaters.
The Unity implementation of this class will coordinate with the VCS integration, with Packman, and ask for user consent
depending on if the sourcecode is versioned or in a package.
This method will be invoked after the beedriver has finished waiting on all running script updaters.
The updates that all sourcefileupdaters have produced that need to be applied
StdOut writing behaviour for a SystemProcessRunnableProgram
Don't log anything
Stream the programs stdout and stderr directly to the host process stdout/stderr
Write to stdout the starting arguments and exist code
Write to stdout the captured stdout when the program finished
Use SystemProcessRunnableProgram to represent a normal system process that can be run.
Constructor
The executable to run
Any arguments that should always be passed to the executable
Constructor
The executable to run
Any arguments that should always be passed to the executable
Environment variables to set when running this program
The stdout logging behaviour to use
The Start implementation.
A helper class to facilitate easy typesafe data transfer between two .net processes that reference a single shared data assembly.
Returns if Write() has already been called
Adds a csharp object as a data payload. It will be serialized and readable on the reading process through .Get()
Adds a csharp object as a data payload. It will be serialized and readable on the reading process through .Get()
Writes all the data that was Add()ed to a file
A helper class to facilitate easy typesafe data transfer between two .net processes that reference a single shared data assembly.
Read and deserialize a json file into an ObjectsFromDisk instance
Read and deserialize a json string into an ObjectsFromDisk instance
Get a deserialied csharp object from a serialized file. It must have been .Add()ed from an ObjectsToDisk class previously
Get a deserialied csharp object from a serialized file. It must have been .Add()ed from an ObjectsToDisk class previously
Get a deserialied csharp object from a serialized file. It must have been .Add()ed from an ObjectsToDisk class previously
Get a deserialied csharp object from a serialized file. It must have been .Add()ed from an ObjectsToDisk class previously
Methods shared by both and
Profile a section tracked by an IDisposable object
TraceEvent duration is calculated the first time Dispose is called.
Label of what is being profiled. If omitted, this is the name of the calling function.
A dictionary of metadata associated with the event.
An IDisposable object tracking the profiled section.
Profiles the submitted Action
Label of what is being profiled.
Code to be profiled.
A dictionary of metadata associated with the event.
Profiles the submitted Func
Label of what is being profiled.
Code to be profiled.
A dictionary of metadata associated with the event.
Profiles the submitted Action
Code to be profiled.
A dictionary of metadata associated with the event.
Default initialized to calling member name
Profiles the submitted Func
Code to be profiled.
A dictionary of metadata associated with the event.
Default initialized to calling member name
A profiler capable of emitting a chrome trace report
Global profiler instance
Resets the global instance
Absolute time of profiler instantiation
Can be used to align event timestamps from other systems to this profiler instance.
Time that has passed since profiler instantiation
Get or implicitly create a track for the current thread
A track need at least one event to be visible in the chrome trace report
Default options for writing a chrome trace report
Create a new profiler instance
Setup a new track
A track for the most common use case represents a thread.
But a user can also explicitly setup a track to hold submitted events and sections.
Name of the track
An instance assigned to the created track
Add .traceevents file to be included in the report
Path to .traceevents file
Add .traceevents file to be included in the report
This function allow you to pass a Task returning the file instead of the file itself.
Using this you can start writing out the profile data, before all ExternalTraceFiles are ready.
ExternalTraceFiles are consumed as late as possible and only when ready.
Task to be completed before appending .traceevents file to the report
Write a chrome trace events to stream
If the extension of the file passed is '.traceevents' this method will invoke WriteChromeTraceEvents(), otherwise it will call WriteChromeTrace()
See .
output file
chrome trace serialization options
Write a chrome trace report data to file
output file
chrome trace serialization options
Write a chrome trace events to stream
This is a list of trace events that can later be concatenated with reports from other processes or sessions.
See .
output file
chrome trace serialization options
Write a chrome trace report data to stream
output stream
chrome trace serialization options
Write a chrome trace events to stream
This is a list of trace events that can later be concatenated with reports from other processes or sessions.
See .
output stream
chrome trace serialization options
A track in the chrome trace report is the same as "lane" or "thread"
A track is either an explicitly created track or implicitly created
for the current thread .
Note that when creating events manually using an external clock source. Make sure timestamp is relative to .
One way to do that is to use .
Track Id
Explicitly created tracks use upper 32 bits to generate unique ids while thread tracks use the lower 32 bits
to store
Name of the track
Thread tracks copy at the time of track creation
Time that has elapsed since the profiler was instantiated
Time of profiler instantiation
Create track from thread
Create track from name
Create and register a trace event with the profiler
Duration can be set after the fact.
Start time of the event. This should be relative instantiation time of the profiler. In most cases .
Label of what is being profiled. If omitted, this is the name of the calling function.
A dictionary of metadata associated with the event.
A trace event initialized according to parameters
Create and register a trace event with the profiler
Timestamp of the event will be set to current time at event creation.
Duration can be set after the fact.
Label of what is being profiled. If omitted, this is the name of the calling function.
A dictionary of metadata associated with the event.
A trace event initialized according to parameters
Create and register a trace event with the profiler
Mainly intended for externally occuring events. Duration can be set after the fact.
Start time of the event.
Label of what is being profiled. If omitted, this is the name of the calling function.
A dictionary of metadata associated with the event.
A trace event initialized according to parameters
Sets duration of the TraceEvent
The event to receive duration
Duration of the event
The event
Sets duration of the TraceEvent to ElapsedProfilerTime - event start time
The event to receive duration
The event
Sets duration of the TraceEvent to endTime - event start time
Mainly intended for externally occuring events and paired with
The event to receive duration
Time when the event ended
The event
TraceEvent
Chrome trace serialization options
If an event has a duration less than this it will be excluded from the report
1 microsecond is default
Id of the process
Defaults to current process id.
Process name as seen in the chrome trace UI
Defaults to entry assembly name.
Process sort index
This index decide how different processes are sorted in the chrome trace report.
Lower indices, including negative ones are sorted topmost.
Additional trace event files
Any additional trace event files that should be merged with the current report.
You need to pass a Task returning the file instead of the file itself.
For more info: .
A dictionary of metadata about the machine that will be emitted in the header
IDisposable struct that records duration on
Record duration
TraceEvents data
We keep structs in a separate array from managed references to create less GC pressure.
We also keep a separate a regular list for Metadata as we assume that usage of metadata is rare and by using a
regular list we can create our own sparse array.
ChromeTrace is responsible for json serialization of TraceEvent data
The implementation is highly specific to the profiler implementation and should not be seen in any way as a
general purpose utility.
BucketArray is optimized for quick lookup and insert
BucketArray will only lock the first time an entry is inserted into a bucket. Bucket sizes grow exponentially.
For an initial bucket size of 1024 that means there are at most 21 buckets for a 32 bit integer range.
Note! get by index isn't protected, which means it's undefined behavior to access an item not previously written.
It may throw a NullReferenceException or return default(T) depending on the situation.
A filesystem path.
The path can be absolute or relative; the entity it refers to could be a file or a directory, and may or may not
actually exist in the filesystem.
Create a new NPath.
The path that this NPath should represent.
Create a new NPath by appending a path fragment.
The path fragment to append. This can be a filename, or a whole relative path.
A new NPath which is the existing path with the fragment appended.
Create a new NPath by appending two path fragments, one after the other.
The first path fragment to append.
The second path fragment to append.
A new NPath which is the existing path with the first fragment appended, then the second fragment appended.
Create a new NPath by appending a path fragment.
The path fragment to append.
A new NPath which is the existing path with the fragment appended.
Create a new NPath by appending multiple path fragments.
The path fragments to append, in order.
A new NPath which is this existing path with all the supplied path fragments appended, in order.
The parent path fragment (i.e. the directory) of the path.
Create a new NPath by computing the existing path relative to some other base path.
The base path that the result should be relative to.
A new NPath, which refers to the same target as the existing path, but is described relative to the given base path.
Create an NPath by changing the extension of this one.
The new extension to use. Starting it with a "." character is optional. If you pass an empty string, the resulting path will have the extension stripped entirely, including the dot character.
A new NPath which is the existing path but with the new extension at the end.
Whether this path is relative (i.e. not absolute) or not.
The name of the file or directory given at the end of this path, including any extension.
The name of the file or directory given at the end of this path, excluding the extension.
Determines whether the given path is, or is a child of, a directory with the given name.
The name of the directory to search for.
True if the path describes a file/directory that is or is a child of a directory with the given name; false otherwise.
The depth of the path, determined by the number of path separators present.
Tests whether the path is the current directory string ".".
Tests whether the path exists.
An optional path fragment to append before testing.
True if the path (with optional appended fragment) exists, false otherwise.
Tests whether the path exists and is a directory.
An optional path fragment to append before testing.
True if the path (with optional appended fragment) exists and is a directory, false otherwise.
Tests whether the path exists and is a file.
An optional path fragment to append before testing.
True if the path (with optional appended fragment) exists and is a file, false otherwise.
The extension of the file, excluding the initial "." character.
UNC server name of the path, if present. Null if not present.
The Windows drive letter of the path, if present. Null if not present.
Provides a quoted version of the path as a string, with the requested path separator type.
The path separator to use. See the SlashMode enum for an explanation of the values. Defaults to SlashMode.Forward.
The path, with the requested path separator type, in quotes.
Convert this path to a string, using forward slashes as path separators.
The string representation of this path.
Convert this path to a string, using the requested path separator type.
The path separator type to use. See SlashMode for possible values.
The string representation of this path.
Checks if this NPath represents the same path as another object.
The object to compare to.
True if this NPath represents the same path as the other object; false if it does not, if the other object is not an NPath, or is null.
Checks if this NPath is equal to another NPath.
The path to compare to.
True if this NPath represents the same path as the other NPath; false otherwise.
Note that the comparison requires that the paths are the same, not just that the targets are the same; "foo/bar" and "foo/baz/../bar" refer to the same target but will not be treated as equal by this comparison. However, this comparison will ignore case differences when the current operating system does not use case-sensitive filesystems.
Compare two NPaths for equality.
The first NPath to compare.
The second NPath to compare.
True if the NPaths are both equal (or both null), false otherwise. See Equals.
Get an appropriate hash value for this NPath.
A hash value for this NPath.
Compare this NPath to another NPath, returning a value that can be used to sort the two objects in a stable order.
The object to compare to. Note that this object must be castable to NPath.
A value that indicates the relative order of the two objects. The return value has these meanings:
ValueMeaning
- Less than zeroThis instance precedes obj in the sort order.
- ZeroThis instance occurs in the same position as obj in the sort order.
- Greater than zeroThis instance follows obj in the sort order.
Compare two NPaths for inequality.
The first NPath to compare.
The second NPath to compare.
True if the NPaths are not equal, false otherwise.
Tests whether this NPath has the provided extension.
The extension to test for.
True if this NPath has has the provided extension. False otherwise.
The extension "*" is special, and will return true for all paths if specified.
Tests whether this NPath has one of the provided extensions, or if no extensions are provided, whether it has any extension at all.
The possible extensions to test for.
True if this NPath has one of the provided extensions; or, if no extensions are provided, true if this NPath has an extension. False otherwise.
The extension "*" is special, and will return true for all paths if specified.
Whether this path is rooted or not (begins with a slash character or drive specifier).
Whether this path starts with an UNC path prefix "\\" or not.
Find all files within this path that match the given filter.
The filter to match against the names of files. Wildcards can be included.
If true, search recursively inside subdirectories of this path; if false, search only for files that are immediate children of this path. Defaults to false.
An array of files that were found.
Find all files within this path.
If true, search recursively inside subdirectories of this path; if false, search only for files that are immediate children of this path. Defaults to false.
An array of files that were found.
Find all files within this path that have one of the provided extensions.
The extensions to search for.
If true, search recursively inside subdirectories of this path; if false, search only for files that are immediate children of this path. Defaults to false.
An array of files that were found.
Find all files or directories within this path that match the given filter.
The filter to match against the names of files and directories. Wildcards can be included.
If true, search recursively inside subdirectories of this path; if false, search only for files and directories that are immediate children of this path. Defaults to false.
An array of files and directories that were found.
Find all files and directories within this path.
If true, search recursively inside subdirectories of this path; if false, search only for files and directories that are immediate children of this path. Defaults to false.
An array of files and directories that were found.
Find all directories within this path that match the given filter.
The filter to match against the names of directories. Wildcards can be included.
If true, search recursively inside subdirectories of this path; if false, search only for directories that are immediate children of this path. Defaults to false.
An array of directories that were found.
Find all directories within this path.
If true, search recursively inside subdirectories of this path; if false, search only for directories that are immediate children of this path. Defaults to false.
An array of directories that were found.
Create an empty file at this path.
This NPath, for chaining further operations.
If a file already exists at this path, it will be overwritten.
Append the given path fragment to this path, and create an empty file there.
The path fragment to append.
The path to the created file, for chaining further operations.
If a file already exists at that path, it will be overwritten.
Create this path as a directory if it does not already exist.
This NPath, for chaining further operations.
This is identical to , except that EnsureDirectoryExists triggers "Stat" callbacks and this doesn't.
Append the given path fragment to this path, and create it as a directory if it does not already exist.
The path fragment to append.
The path to the created directory, for chaining further operations.
Create this path as a symbolic link to another file or directory.
The path that this path should be a symbolic link to. Can be relative or absolute.
Specifies whether this link is to a file or to a directory (required on Windows). Defaults to file.
The path to the created symbolic link, for chaining further operations.
Checks whether the entity referred to by this path is a symbolic link.
Copy this NPath to the given destination.
The path to copy to.
The path to the copied result, for chaining further operations.
Copy this NPath to the given destination, applying a filter function to decide which files are copied.
The path to copy to.
The filter function. Each candidate file is passed to this function; if the function returns true, the file will be copied, otherwise it will not.
Create a new NPath by converting this path into an absolute representation.
Optional base to use as a root for relative paths.
Deletes the file or directory referred to by the NPath.
The deletion mode to use, see DeleteMode. Defaults to DeleteMode.Normal.
The path does not exist. See also DeleteIfExists.
Deletes the file or directory referred to by the NPath, if it exists.
The deletion mode to use, see DeleteMode. Defaults to DeleteMode.Normal.
This NPath, for chaining further operations.
Deletes all files and directories inside the directory referred to by this NPath.
This NPath, for chaining further operations.
This NPath refers to a file, rather than a directory.
Create a temporary directory in the system temporary location and return the NPath of it.
A prefix to use for the name of the temporary directory.
A new NPath which targets the newly created temporary directory.
Move the file or directory targetted by this NPath to a new location.
The destination for the move.
An NPath representing the newly moved file or directory.
The current directory in use by the process.
Note that every read from this property will result in an operating system query, unless WithFrozenCurrentDirectory is used.
Temporarily change the current directory for the process.
The new directory to set as the current directory.
A token representing the change in current directory. When this is disposed, the current directory will be returned to its previous value. The usual usage pattern is to capture the token with a using statement, such that it is automatically disposed of when the using block exits.
The current user's home directory.
The system temporary directory.
Append an optional path fragment to this NPath, then create it as a directory if it does not already exist.
The path fragment to append.
The path to the directory that is now guaranteed to exist.
This is identical to , except that this triggers "Stat" callbacks and CreateDirectory doesn't.
Create the parent directory of this NPath if it does not already exist.
This NPath, for chaining further operations.
Throw an exception if this path does not exist as a file.
This path, in order to chain further operations.
The path does not exist, or is not a file.
Throw an exception if this directory does not exist.
This path, in order to chain further operations.
The path does not exist, or is not a directory.
Check if this path is a child of the given path hierarchy root (i.e. is a file or directory that is inside the given hierachy root directory or one of its descendent directories).
The path hierarchy root to check.
True if this path is a child of the given root path, false otherwise.
Check if this path is a child of the given path hierarchy root (i.e. is a file or directory that is inside the given hierachy root directory or one of its descendent directories), or is equal to it.
The path hierarchy root to check.
True if this path is equal to or is a child of the given root path, false otherwise.
Return each parent directory of this path, starting with the immediate parent, then that directory's parent, and so on, until the root of the path is reached.
Search all parent directories of this path for one that contains a file or directory with the given name.
The name of the file or directory to search for.
The path to the parent directory that contains the file or directory, or null if none of the parents contained a file or directory with the requested name.
Open this path as a text file, write the given string to it, then close the file.
The string to write to the text file.
The path to this file, for use in chaining further operations.
Open this file as a text file, and replace the contents with the provided string, if they do not already match. Then close the file.
The string to replace the file's contents with.
The path to this file, for use in chaining further operations.
Note that if the contents of the file already match the provided string, the file is not modified - this includes not modifying the file's "last written" timestamp.
Open this path as a file, write the given bytes to it, then close the file.
The bytes to write to the file.
The path to this file, for use in chaining further operations.
Opens a text file, reads all the text in the file into a single string, then closes the file.
The contents of the text file, as a single string.
Opens a file, reads all the bytes in the file, then closes the file.
The contents of the file, as a bytes array.
Opens a text file, writes all entries of a string array as separate lines into the file, then closes the file.
The entries to write into the file as separate lines.
The path to this file.
Opens a text file, reads all lines of the file into a string array, and then closes the file.
A string array containing all lines of the file.
Copy all files in this NPath to the given destination directory.
The directory to copy the files to.
If true, files inside subdirectories of this NPath will also be copied. If false, only immediate child files of this NPath will be copied.
An optional predicate function that can be used to filter files. It is passed each source file path in turn, and if it returns true, the file is copied; otherwise, the file is not copied.
The paths to all the newly copied files.
Note that the directory structure of the files relative to this NPath will be preserved within the target directory.
Move all files in this NPath to the given destination directory.
The directory to move the files to.
If true, files inside subdirectories of this NPath will also be moved. If false, only immediate child files of this NPath will be moved.
An optional predicate function that can be used to filter files. It is passed each source file path in turn, and if it returns true, the file is moved; otherwise, the file is not moved.
The paths to all the newly moved files.
Note that the directory structure of the files relative to this NPath will be preserved within the target directory.
Implicitly construct a new NPath from a string.
The string to construct the new NPath from.
Set the last time the file was written to, in UTC.
The last time the file was written to, in UTC.
This is set automatically by the OS when the file is modified, but it can sometimes be useful
to explicitly update the timestamp without modifying the file contents.
Get the last time the file was written to, in UTC.
The last time the file was written to, in UTC.
Get the file length in bytes.
The file length in bytes.
The filesystem attributes of the given file, assuming it exists. Note that when you set this property, the
OS may still modify the the actual attributes of the file beyond what you requested, so setting and then
getting the property is not guaranteed to roundtrip the value. Note also that some attributes (e.g.
FileAttributes.Hidden) are not supported on every OS, and may throw exceptions or simply be ignored.
Until .Dispose is invoked on the returnvalue, makes all NPath's on this thread use the provided filesystem implementation for all filesystem access.
An object you can invoke .Dispose() on, which will make all NPath filesystem operations stop using the provided filesystem
Lets the currently active filesystem resolve the path.
Shorthand for .ResolveWithFileSystem.InQuotes()
Abstract baseclass you can use to plug in different underlying filesystem behaviour for NPath to operate on
The currently active filesystem for NPath operations. Set this using NPath.WithFileSystem()
If your filesystem does any kind of redirection or other magic, Resolve() is required to return the path that can be used against the raw lowlevel filesystem of the OS.
The path to resolve
The resolved path that is valid to use against the OS's real filesystem
A Filesystem that forwards all calls to another filesytem. Derive your own filesystem from this if you only want to
change the behaviour of a few methods.
The filesystem all methods will be forwarded to
Constructor
the filesystem all calls will be forwarded to
Temporarily assume that the current directory is a given value, instead of querying it from the environment when needed, in order to improve performance.
The current directory to assume.
A token representing the registered callback. This should be disposed of when the assumption is no longer required. The usual usage pattern is to capture the token with a using statement, such that it is automatically disposed of when the using block exits.
NPath-related extension methods for other common types.
Copy these NPaths into the given directory.
An enumerable sequence of NPaths.
The path to the target directory.
The paths to the newly copied files.
All path information in the source paths is ignored, other than the final file name; the resulting copied files and directories will all be immediate children of the target directory.
Move these NPaths into the given directory.
An enumerable sequence of NPaths.
The path to the target directory.
The paths to the newly moved files.
All path information in the source paths is ignored, other than the final file name; the resulting moved files and directories will all be immediate children of the target directory.
Delete the files/directories targetted by these paths.
The paths to delete.
All paths that were passed in to the method.
Convert all these paths to quoted strings, using the requested path separator type.
The paths to convert.
The path separator type to use. Defaults to SlashMode.Forward.
The paths, converted to quoted strings.
Construct a new NPath from this string.
The string to construct the path from.
A new NPath constructed from this string.
Construct new NPaths from each of these strings.
The strings to construct NPaths from.
The newly constructed NPaths.
Invokes .ResolveWithFileSystem on all NPaths
Invokes InQuotesResolved on all NPaths
Describes the different kinds of path separators that can be used when converting NPaths back into strings.
Use the slash mode that is native for the current platform - backslashes on Windows, forward slashes on macOS and Linux systems.
Use forward slashes as path separators.
Use backslashes as path separators.
Specifies the way that directory deletion should be performed.
When deleting a directory, if an IOException occurs, rethrow it.
When deleting a directory, if an IOException occurs, ignore it. The deletion request may or may not be later fulfilled by the OS.