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 // MARK: Properties
private let archivesPath: String
private let fileService: any FileServicing private let fileService: any FileServicing
private let folderArchives: String
// MARK: Initialisers // MARK: Initialisers
/// Initialises this controller. /// Initialises this controller.
/// - Parameters: /// - 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. /// - fileService: A service that interfaces with the local file system.
init( init(
_ folderArchives: String, _ archivesPath: String,
fileService: any FileServicing = FileService() fileService: any FileServicing = FileService()
) { ) {
self.folderArchives = folderArchives self.archivesPath = archivesPath
self.fileService = fileService self.fileService = fileService
} }
@ -44,7 +44,7 @@ private extension ArchiveController {
) async throws (HTTPError) -> ArchiveList { ) async throws (HTTPError) -> ArchiveList {
do { do {
let nameArchives = try await fileService let nameArchives = try await fileService
.listItems(in: folderArchives) .listItems(in: archivesPath)
.filter { $0.hasSuffix(.suffixArchive) } .filter { $0.hasSuffix(.suffixArchive) }
.map { $0.dropLast(String.suffixArchive.count) } .map { $0.dropLast(String.suffixArchive.count) }
.map(String.init) .map(String.init)