Skip to content

Commit 7999180

Browse files
committed
[utils] util_entry constrain rs232 output to 8.3 filenames, get last extender.
1 parent 59cc0ed commit 7999180

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/utils/utils.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ std::string util_crunch(std::string filename)
223223
#ifdef BUILD_RS232
224224
std::string util_entry(std::string crunched, size_t fileSize, bool is_dir, bool is_locked)
225225
{
226-
size_t ext_pos = crunched.find(".");
226+
size_t ext_pos = crunched.find_last_of(".");
227227
std::string basename = crunched.substr(0, ext_pos);
228228
std::string ext = crunched.substr(ext_pos + 1);
229229
char e[80];
@@ -234,6 +234,10 @@ std::string util_entry(std::string crunched, size_t fileSize, bool is_dir, bool
234234
unsigned char minutes = 0;
235235
char ampm = 'p';
236236

237+
// Constrain to 8 characters
238+
basename = basename.substr(0,8);
239+
ext = ext.substr(0,3);
240+
237241
memset(e,0,sizeof(e));
238242

239243
if (is_dir)

0 commit comments

Comments
 (0)