Commit 479bd24c authored by Rob Swindell's avatar Rob Swindell 💬
Browse files

De-dupe random menu filenames by truncating at first dot, rather than last.

Fix for one of the problems described in issue #380.

bbs.menu("random*"); would display column-width-specific files (e.g.
random.132col.msg) even when they weren't appropriate for the current
user terminal width.

This is fixed by truncating the filenames matching the requested pattern at
their first-dot rather than the last.

The downside is, you can't have a set of random.#.* files, where # is the
unique part of the filename and * is the file-type extension. Just use
the naming pattern "random-#.*" instead (or something similar) instead.
parent 3fa6bebb
Pipeline #2925 passed with stage
in 9 minutes and 29 seconds
......@@ -325,7 +325,7 @@ bool sbbs_t::random_menu(const char *name, long mode, JSObject* obj)
return false;
}
for(size_t i = 0; i < g.gl_pathc; i++) {
char* ext = getfext(g.gl_pathv[i]);
char* ext = strchr(g.gl_pathv[i], '.'); // intentionally not using getfext() - issue #380
if(ext == NULL)
continue;
*ext = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment