From 21f504fc8e7dd3f805c52365ac3c8fc18b600ef7 Mon Sep 17 00:00:00 2001 From: dec2-anon <119710906+dec2-anon@users.noreply.github.com> Date: Thu, 15 Dec 2022 21:17:00 +0600 Subject: [PATCH] Add Filename Character Limit (#19) Co-authored-by: Stefan-Hintz --- swift/StableDiffusionCLI/main.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/swift/StableDiffusionCLI/main.swift b/swift/StableDiffusionCLI/main.swift index 316ab12..4da8e62 100644 --- a/swift/StableDiffusionCLI/main.swift +++ b/swift/StableDiffusionCLI/main.swift @@ -155,7 +155,8 @@ struct StableDiffusionSample: ParsableCommand { } func imageName(_ sample: Int, step: Int? = nil) -> String { - var name = prompt.replacingOccurrences(of: " ", with: "_") + let fileCharLimit = 75 + var name = prompt.prefix(fileCharLimit).replacingOccurrences(of: " ", with: "_") if imageCount != 1 { name += ".\(sample)" }