Add Filename Character Limit
Very long prompts cause the error:
Error: saving("Failed to create destination for file:///path/prompt.seed.final.png"
Actually might want to change fileCharLimit to a let since it never mutated
change fixes too long of a filename issue for me. thanks!
Thank you for your interest in contributing to Core ML Stable Diffusion! Please review CONTRIBUTING.md. If you would like to proceed with this pull request, please indicate your agreement to the terms outlined in CONTRIBUTING.md by checking the box below.
We appreciate your interest in the project!
- [ ] I agree to the terms outlined in CONTRIBUTING.md
- [x] I agree to the terms outlined in CONTRIBUTING.md
@msiracusa as mentioned in #53, please revert this contribution. It incorrectly conflates 75 characters with 75 words. This means users will now have their images overwritten if they change a reasonably complex prompt (e.g. 300 characters and 74 words) by changing the last word.
My solution factored in not only the file name, but the total path name length. It also allows more varied length in file name and even warns you when it’s going to overwrite a file you didn’t want.
You're right, this is more of a bandaid fix. But #53 seems to do a lot more than just add a path character limit. Don't know if a separate metadata file is a good idea. It would get messy with lots of generations
If they decide to merge #53 then I suggest we add the metadata description containing the prompt directly to the generated image.
@philipturner Followup: I was tinkering with NSAppleScript and I got it to add the metadata details into the kMDItemFinderComment attribute
I'll create another PR later today when I rewrite it in native swift code without AppleScript