Skip to content

Commit

Permalink
perf(Compressor): add processed path in compress method return
Browse files Browse the repository at this point in the history
  • Loading branch information
wibus-wee committed Dec 3, 2023
1 parent ac0e611 commit 12b7055
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions PhotosProcessor/Backend/Compressor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)!
Expand Down Expand Up @@ -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
Expand All @@ -69,6 +69,6 @@ class Compressor {
if configuration.executeImmediately {
commandQueue.execute(id: id)
}
return id;
return (id, compressCommand!.processedPath)
}
}

0 comments on commit 12b7055

Please sign in to comment.