Renamed the "folderArchives" property for the ArchiveController controller in the library target as "archivesPath".

This commit is contained in:
Javier Cicchelli 2025-03-26 00:43:05 +01:00
parent b13ba625f4
commit f9cdef7312

View File

@ -5,20 +5,20 @@ struct ArchiveController<Context: RequestContext> {
// MARK: Properties
private let archivesPath: String
private let fileService: any FileServicing
private let folderArchives: String
// MARK: Initialisers
/// Initialises this controller.
/// - Parameters:
/// - folderArchives: A folder in the file system where the *DocC* archive contained are located.
/// - archivesPath: A path in the local file system where the *DocC* archive contained are located.
/// - fileService: A service that interfaces with the local file system.
init(
_ folderArchives: String,
_ archivesPath: String,
fileService: any FileServicing = FileService()
) {
self.folderArchives = folderArchives
self.archivesPath = archivesPath
self.fileService = fileService
}
@ -44,7 +44,7 @@ private extension ArchiveController {
) async throws (HTTPError) -> ArchiveList {
do {
let nameArchives = try await fileService
.listItems(in: folderArchives)
.listItems(in: archivesPath)
.filter { $0.hasSuffix(.suffixArchive) }
.map { $0.dropLast(String.suffixArchive.count) }
.map(String.init)