TemporaryRepos
Manages a temporary folder on disk for linelist preparation artefacts. Creates, sanitises, and cleans up files within a dedicated repository directory. Automatically deletes all content on termination.
Depends on: ProjectError
Version: 1.0 (2026-02-09)
Factory helpers
create #
Build and initialise a temporary repository service
Signature:
Public Function Create(Optional ByVal baseDirectory As String) As ITemporaryRepos
Parameters:
baseDirectory: String. Optional custom root location.
Returns: ITemporaryRepos. Ready for use.
Lifecycle
Paths
root-path #
Fully-qualified repository root
Signature:
Public Property Get RootPath() As String
Returns: String. Absolute path ending with a path separator.
create-file-path #
Generate a safe path for a new temporary file within the repository
Signature:
Public Function CreateFilePath(ByVal fileName As String) As String
Parameters:
fileName: String. Requested file name (sanitised when required).
Returns: String. Absolute path ready for file creation.
File operations
Internal members (not exported)
Factory helpers
initialise #
Set the root path and mark the repository as not ready
Signature:
Friend Sub Initialise(Optional ByVal baseDirectory As String)
Parameters:
baseDirectory: String. Optional custom root location.
Internal helpers
resolve-root-path #
Determine the root directory used for temporary storage
Signature:
Private Function ResolveRootPath(ByVal baseDirectory As String) As String
Parameters:
baseDirectory: String. Optional path supplied by the caller.
Returns: String. Fully-qualified path ending with the repository folder.
ensure-directory-exists #
Create the supplied folder when missing and validate existing paths
Signature:
Private Sub EnsureDirectoryExists(ByVal folderPath As String)
Parameters:
folderPath: String. Path that should represent a directory.
create-directory-tree #
Create a directory and all missing parents
Signature:
Private Sub CreateDirectoryTree(ByVal folderPath As String)
Parameters:
folderPath: String. Fully-qualified target folder.
is-directory #
Determine whether the supplied path points to a folder
Signature:
Private Function IsDirectory(ByVal path As String) As Boolean
Parameters:
path: String. Path to test.
Returns: Boolean. True when the path is an existing directory.
normalize-path #
Remove trailing separators and normalise the supplied path string
Signature:
Private Function NormalizePath(ByVal path As String, ByVal sep As String) As String
Parameters:
path: String. Raw path.sep: String. Platform path separator.
Returns: String. Cleaned path.
sanitize-file-name #
Replace characters that are invalid on common file systems
Signature:
Private Function SanitizeFileName(ByVal fileName As String) As String
Parameters:
fileName: String. Candidate file name.
Returns: String. Safe to append to the repository root.
delete-all-internal #
Wipe every file inside the repository without recreating the folder
Signature:
Private Sub DeleteAllInternal()
class-terminate #
Clean up temporary files when the instance is destroyed
Signature:
Private Sub Class_Terminate()
throw-error #
Raise a typed project error
Signature:
Private Sub ThrowError(ByVal errNumber As ProjectError, ByVal message As String)
Parameters:
errNumber: ProjectError. The error code.message: String. Descriptive error message.