TemporaryRepos
Owns one folder on disk that a linelist build writes its working files into. Create takes the base directory, or falls back to the default one. RootPath answers the folder, EnsureReady creates it, and CreateFilePath builds a path inside it from a file name it cleans first. DeleteFile removes one file, DeleteAll empties the folder and creates it again, and Reset empties it and marks the object as needing another EnsureReady. Terminating an instance empties the folder.
Depends on: ProjectError
Version: 1.0 (2026-02-09)
Factory helpers
Create #
create
Build and initialise a temporary repository service
Signature:
Public Function Create(Optional ByVal baseDirectory As String) As TemporaryRepos
Parameters:
baseDirectory: String. Optional custom root location.
Returns: TemporaryRepos. Ready for use.
Lifecycle
Paths
RootPath #
root-path
Fully-qualified repository root
Signature:
Public Property Get RootPath() As String
Returns: String. Absolute path ending with a path separator.
CreateFilePath #
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
DeleteFile #
delete-file
Delete a single file; silently ignore missing paths
Signature:
Public Sub DeleteFile(ByVal path As String)
Parameters:
path: String. Absolute file path.
DeleteAll #
delete-all
Remove every file within the repository, then recreate the root folder
Signature:
Public Sub DeleteAll()
Internal members (not exported)
Factory helpers
Initialise #
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
ResolveRootPath #
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.
EnsureDirectoryExists #
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.
CreateDirectoryTree #
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.
IsDirectory #
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.
NormalizePath #
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.
SanitizeFileName #
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.
DeleteAllInternal #
delete-all-internal
Wipe every file inside the repository, keeping the folder itself
Signature:
Private Sub DeleteAllInternal()
The whole listing is read before the first file is deleted. Dir$ walks one folder through state the host holds, and deleting an entry part way through that walk makes the rest of the listing unreliable, so files were left behind. The listing is small: this folder holds the working files of one generation.
Class_Terminate #
class-terminate
Clean up temporary files when the instance is destroyed
Signature:
Private Sub Class_Terminate()
ThrowError #
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.
Used in (8 file(s))
- CodeTransfer.cls
- Linelist.cls
- LinelistSpecs.cls
- HeadlessBuild.bas
- TestTemporaryRepos.bas
- TestHeadlessLinelistBuild.bas
- TestCodeTransfer.bas
- OBTProbeSandbox.bas