fix the too long filename bug when using a smaller width param. also added some extra text for output length of binary strings in decode. One tend to not see if its 25 or 26 bits sometimes :)
This commit is contained in:
1 parent
00dfd6e5f1
commit
a79b2bb725
4 files changed
+50
-11
No files matched your search
@@ -239,6 +239,22 @@ char *newfilenamemcopyEx(const char *preferredName, const char *suffix, savePath
|
||||
return fileName;
|
||||
}
|
||||
|
||||
// trunacate down a filename to LEN size
|
||||
void truncate_filename(char *fn, uint16_t maxlen) {
|
||||
if (fn == NULL || maxlen < 5) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the filename is already shorter than or equal to the desired length
|
||||
if (strlen(fn) <= maxlen) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If there's no extension or it's too long, just truncate the filename
|
||||
fn[maxlen - 3] = '\0';
|
||||
strcat(fn, "...");
|
||||
}
|
||||
|
||||
// --------- SAVE FILES
|
||||
int saveFile(const char *preferredName, const char *suffix, const void *data, size_t datalen) {
|
||||
|
||||
|
||||
Reference in new issue
Block a user