Skip to content

IFileSystem Interface

Abstracts basic file system operations.

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
Section titled “CopyFile(sourceLineNumbers, source, destination, allowHardlink) Method”

Copies a file.

public void CopyFile(
WixToolset.Data.SourceLineNumber sourceLineNumbers,
string source,
string destination,
bool allowHardlink
)
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

Section titled “DeleteFile(sourceLineNumbers, source, throwOnError, maxRetries) Method”

Deletes a file.

public void DeleteFile(
WixToolset.Data.SourceLineNumber sourceLineNumbers,
string source,
bool throwOnError,
int maxRetries
)
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

Section titled “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).

public void ExecuteWithRetries(
System.Action action,
int maxRetries
)
ParameterTypeDescription
actionSystem.ActionAction to execute.
maxRetriesintMaximum retry attempts. Default is 4.

MoveFile(sourceLineNumbers, source, destination) Method

Section titled “MoveFile(sourceLineNumbers, source, destination) Method”

Moves a file.

public void MoveFile(
WixToolset.Data.SourceLineNumber sourceLineNumbers,
string source,
string destination
)
ParameterTypeDescription
sourceLineNumbersWixToolset.Data.SourceLineNumberOptional source line number requiring the move.
sourcestringThe file to move.
destinationstringThe destination file.

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

Section titled “OpenFile(sourceLineNumbers, path, mode, access, share) Method”

Opens a file.

public System.IO.FileStream OpenFile(
WixToolset.Data.SourceLineNumber sourceLineNumbers,
string path,
System.IO.FileMode mode,
System.IO.FileAccess access,
System.IO.FileShare share
)
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.