Skip to main content

IFileSystem Interface

Abstracts basic file system operations.

Methods

MethodDescription
CopyFile(sourceLineNumbers, source, destination, allowHardlink)Copies a file.
DeleteFile(sourceLineNumbers, source, throwOnError, maxRetries)Deletes a file.
ExecuteWithRetries(action, maxRetries)Executes an action and retries on any exception a few times with short pause between each attempt. Primarily intended for use with file system operations that might get interrupted by external systems (usually anti-virus).
MoveFile(sourceLineNumbers, source, destination)Moves a file.
OpenFile(sourceLineNumbers, path, mode, access, share)Opens a file.

WixToolset.Extensibility.dll version 5.0.0+41e11442b2ca93e444b60213b5ae99dcbab787d8

Copies a file.

Declaration

public void CopyFile(
WixToolset.Data.SourceLineNumber sourceLineNumbers,
string source,
string destination,
bool allowHardlink
)

Parameters

ParameterTypeDescription
sourceLineNumbersWixToolset.Data.SourceLineNumberOptional source line number requiring the copy.
sourcestringThe file to copy.
destinationstringThe destination file.
allowHardlinkboolAllow hardlinks.

DeleteFile(sourceLineNumbers, source, throwOnError, maxRetries) Method

Deletes a file.

Declaration

public void DeleteFile(
WixToolset.Data.SourceLineNumber sourceLineNumbers,
string source,
bool throwOnError,
int maxRetries
)

Parameters

ParameterTypeDescription
sourceLineNumbersWixToolset.Data.SourceLineNumberOptional source line number requiring the delete.
sourcestringThe file to delete.
throwOnErrorboolIndicates the file must be deleted. Default is a best effort delete.
maxRetriesintMaximum retry attempts. Default is 4.

ExecuteWithRetries(action, maxRetries) Method

Executes an action and retries on any exception a few times with short pause between each attempt. Primarily intended for use with file system operations that might get interrupted by external systems (usually anti-virus).

Declaration

public void ExecuteWithRetries(
System.Action action,
int maxRetries
)

Parameters

ParameterTypeDescription
actionSystem.ActionAction to execute.
maxRetriesintMaximum retry attempts. Default is 4.

MoveFile(sourceLineNumbers, source, destination) Method

Moves a file.

Declaration

public void MoveFile(
WixToolset.Data.SourceLineNumber sourceLineNumbers,
string source,
string destination
)

Parameters

ParameterTypeDescription
sourceLineNumbersWixToolset.Data.SourceLineNumberOptional source line number requiring the move.
sourcestringThe file to move.
destinationstringThe destination file.

OpenFile(sourceLineNumbers, path, mode, access, share) Method

Opens a file.

Declaration

public System.IO.FileStream OpenFile(
WixToolset.Data.SourceLineNumber sourceLineNumbers,
string path,
System.IO.FileMode mode,
System.IO.FileAccess access,
System.IO.FileShare share
)

Parameters

ParameterTypeDescription
sourceLineNumbersWixToolset.Data.SourceLineNumberOptional source line number requiring the file.
pathstringThe file to open.
modeSystem.IO.FileModeA System.IO.FileMode value that specifies whether a file is created if one does not exist, and determines whether the contents of existing files are retained or overwritten.
accessSystem.IO.FileAccessA System.IO.FileAccess value that specifies the operations that can be performed on the file.
shareSystem.IO.FileShareA System.IO.FileShare value specifying the type of access other threads have to the file.