From 12b70553d175e9a6b8de90f61d4c64b790ae483d Mon Sep 17 00:00:00 2001 From: wibus-wee <1596355173@qq.com> Date: Sun, 3 Dec 2023 22:39:52 +0800 Subject: [PATCH] perf(Compressor): add processed path in compress method return --- PhotosProcessor/Backend/Compressor.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PhotosProcessor/Backend/Compressor.swift b/PhotosProcessor/Backend/Compressor.swift index 48d3c42..c9a8d53 100644 --- a/PhotosProcessor/Backend/Compressor.swift +++ b/PhotosProcessor/Backend/Compressor.swift @@ -19,7 +19,7 @@ struct CompressorConfig { } class Compressor { - func avifencCommand(imagePath: String, config: CompressorConfig) -> (command: String, arguments: [String])? { + func avifencCommand(imagePath: String, config: CompressorConfig) -> (command: String, arguments: [String], processedPath: String)? { var avifencPath = "" if (configuration.avifencLocationType == "built-in") { avifencPath = Bundle.main.path(forResource: "avifenc", ofType: nil)! @@ -55,10 +55,10 @@ class Compressor { arguments.append(imagePath) arguments.append(avifImagePath) - return (avifencPath, arguments) + return (avifencPath, arguments, avifImagePath) } - func compress(path: String, name: String, config: CompressorConfig) -> UUID? { + func compress(path: String, name: String, config: CompressorConfig) -> (id: UUID, processedPath: String)? { let compressCommand = self.avifencCommand(imagePath: path, config: config) if compressCommand == nil { return nil @@ -69,6 +69,6 @@ class Compressor { if configuration.executeImmediately { commandQueue.execute(id: id) } - return id; + return (id, compressCommand!.processedPath) } }