Class DirectoryBuilder
Builds a file system directory on-disk.
Namespace: ZeroInstall.Store.FileSystem
Assembly: ZeroInstall.Store.dll
Syntax
public class DirectoryBuilder : MarshalNoTimeout, IBuilder, IForwardOnlyBuilder
Constructors
DirectoryBuilder(String, IBuilder)
Creates a new builder.
Declaration
public DirectoryBuilder(string path, IBuilder innerBuilder = null)
Parameters
Type | Name | Description |
---|---|---|
String | path | The path to the directory to build the implementation in. |
IBuilder | innerBuilder | An additional IBuilder to pass all calls on to as well. Usually ManifestBuilder. |
Properties
AllowedHardlinkRoot
A directory all hardlink targets must be a child of. Defaults to Path.
Declaration
public string AllowedHardlinkRoot { get; set; }
Property Value
Type | Description |
---|---|
String |
Path
The path to the directory to build the implementation in.
Declaration
public string Path { get; }
Property Value
Type | Description |
---|---|
String |
Methods
AddDirectory(String)
Adds a subdirectory to the implementation.
Declaration
public void AddDirectory(string path)
Parameters
Type | Name | Description |
---|---|---|
String | path | The path of the directory to create relative to the implementation root. |
Exceptions
Type | Condition |
---|---|
UnauthorizedAccessException | Access to a resource was denied. |
IOException | An IO operation failed. |
AddFile(String, Stream, UnixTime, Boolean)
Adds a file to the implementation.
Declaration
public void AddFile(string path, Stream stream, UnixTime modifiedTime, bool executable = false)
Parameters
Type | Name | Description |
---|---|---|
String | path | The path of the file to create relative to the implementation root. |
Stream | stream | The contents of the file. |
UnixTime | modifiedTime | The last write time to set for the file. |
Boolean | executable |
|
Exceptions
Type | Condition |
---|---|
UnauthorizedAccessException | Access to a resource was denied. |
IOException | An IO operation failed. |
AddHardlink(String, String, Boolean)
Adds a hardlink to the implementation.
Declaration
public void AddHardlink(string path, string target, bool executable = false)
Parameters
Type | Name | Description |
---|---|---|
String | path | The path of the hardlink to create relative to the implementation root. |
String | target | The path of the existing file the hardlink shall be based on relative to the implementation root. Must point |
Boolean | executable |
|
Exceptions
Type | Condition |
---|---|
UnauthorizedAccessException | Access to a resource was denied. |
IOException | An IO operation failed. |
NotSupportedException | The currently platform or builder does not support hardlinks. Use AddFile(String, Stream, UnixTime, Boolean) instead. |
AddSymlink(String, String)
Adds a symbolic link to the implementation.
Declaration
public void AddSymlink(string path, string target)
Parameters
Type | Name | Description |
---|---|---|
String | path | The path of the symlink to create relative to the implementation root. |
String | target | The target the symbolic link shall point to relative to |
Exceptions
Type | Condition |
---|---|
UnauthorizedAccessException | Access to a resource was denied. |
IOException | An IO operation failed. |
MarkAsExecutable(String)
Marks a previously added file as executable.
Declaration
public void MarkAsExecutable(string path)
Parameters
Type | Name | Description |
---|---|---|
String | path | The path of the file to create relative to the implementation root. |
Exceptions
Type | Condition |
---|---|
UnauthorizedAccessException | Access to a resource was denied. |
IOException | An IO operation failed. |
Remove(String)
Removes a file or directory from the implementation.
Declaration
public void Remove(string path)
Parameters
Type | Name | Description |
---|---|---|
String | path | The path of the file or directory relative to the implementation root. |
Exceptions
Type | Condition |
---|---|
UnauthorizedAccessException | Access to a resource was denied. |
IOException | An IO operation failed. |
Rename(String, String)
Renames a file or directory in the implementation.
Declaration
public void Rename(string path, string target)
Parameters
Type | Name | Description |
---|---|---|
String | path | The original path of the file or directory relative to the implementation root. |
String | target | The new path of the file or directory relative to the implementation root. |
Exceptions
Type | Condition |
---|---|
UnauthorizedAccessException | Access to a resource was denied. |
IOException | An IO operation failed. |
TurnIntoSymlink(String)
Turns a previously added file into a symlink.
Declaration
public void TurnIntoSymlink(string path)
Parameters
Type | Name | Description |
---|---|---|
String | path | The path of the symlink to create relative to the implementation root. |
Exceptions
Type | Condition |
---|---|
UnauthorizedAccessException | Access to a resource was denied. |
IOException | An IO operation failed. |