simplify file name sanitization #399
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/cleanup-filename"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
The routine copies
fileNameLen
characters from the original filename plus one additional character or a trailing blank. This additional char is overwritten by a terminating null-byte afterwards anyway.Remove the redundant check and simplify the loop.
Also only truncate the filename, if the actual length is greater than the limit.
With
>= MAX_PRINTABLE_FILENAME_LEN
we would remove the last character of a valid file name, e.g.0123456789abcdefghij.gcode
would be printed as0123456789abcdefghi~.gcode
Requirements
Applies to targets with DGUS-clone display.
Benefits
Cleaner and faster code. No truncation for 26 character filenames.
Configurations
--
Related Issues
closes #393
Discussed and tested with @leonel85 in https://github.com/knutwurst/Marlin-2-0-x-Anycubic-i3-MEGA-S/issues/393#issuecomment-1360881584