Skip to content
Snippets Groups Projects
Commit 2e2508c3 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Merge branch 'ddfilelister_filename_no_ext_fix' into 'master'

DD File Lister bug fix: Now successfully formats filenames without extensions when listing files.

See merge request main/sbbs!155
parents 91839936 c6143a0e
No related branches found
No related tags found
No related merge requests found
......@@ -22,11 +22,14 @@
* Things overall look good. Releasing this version. Added
* the ability to do searching via filespec, description, and
* new file search (started working on this 2022-02-08).
* 2022-02027 Eric Oulashin Version 2.03
* 2022-02-27 Eric Oulashin Version 2.03
* For terminals over 25 rows tall, the file info window will
* now be up to 45 rows tall. Also, fixed the display of the
* trailing blocks for the list header for wide terminals (over
* 80 columns).
* 2022-03-09 Eric Oulashin Version 2.04
* Bug fix: Now successfully formats filenames without extensions
* when listing files.
*/
if (typeof(require) === "function")
......@@ -80,8 +83,8 @@ if (system.version_num < 31900)
}
// Lister version information
var LISTER_VERSION = "2.03";
var LISTER_DATE = "2022-02-27";
var LISTER_VERSION = "2.04";
var LISTER_DATE = "2022-03-09";
///////////////////////////////////////////////////////////////////////////////
......@@ -2932,7 +2935,12 @@ function shortenFilename(pFilename, pMaxLen, pFillWidth)
if (typeof(pMaxLen) !== "number" || pMaxLen < 1)
return "";
var shortenedFilename = ""; // Will contain the shortened filename
// Get the filename extension. And the way we shorten the filename
// will depend on whether the filename actually has an extension or not.
var filenameExt = file_getext(pFilename);
if (typeof(filenameExt) === "string")
{
var filenameWithoutExt = file_getname(pFilename);
var extIdx = filenameWithoutExt.indexOf(filenameExt);
if (extIdx >= 0)
......@@ -2943,13 +2951,14 @@ function shortenFilename(pFilename, pMaxLen, pFillWidth)
filenameWithoutExt = filenameWithoutExt.substr(0, maxWithoutExtLen);
var fillWidth = (typeof(pFillWidth) === "boolean" ? pFillWidth : false);
var adjustedFilename = "";
if (fillWidth)
adjustedFilename = format("%-" + maxWithoutExtLen + "s%s", filenameWithoutExt, filenameExt);
shortenedFilename = format("%-" + maxWithoutExtLen + "s%s", filenameWithoutExt, filenameExt);
else
adjustedFilename = filenameWithoutExt + filenameExt;
return adjustedFilename;
shortenedFilename = filenameWithoutExt + filenameExt;
}
else
shortenedFilename = pFilename.substr(0, pMaxLen);
return shortenedFilename;
}
......
Digital Distortion File Lister
Version 2.03
Release date: 2022-02-27
Version 2.04
Release date: 2022-03-09
by
......
......@@ -5,6 +5,8 @@ Revision History (change log)
=============================
Version Date Description
------- ---- -----------
2.04 2022-03-09 Bug fix: Now successfully formats filenames without
extensions when listing files.
2.03 2022-02-27 For terminals over 80 rows tall, the file info window will
now be up to 45 rows tall. Also, fixed the display of the
trailing blocks for the list header for wide terminals
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment