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

Merge branch 'dd_file_lister_console_aborted_return_negative1' into 'master'

DDFileLister: On start, if console.aborted is true (due to the user pressing Ctrl-C, etc.), then return -1 to stop a file scan in progress.

See merge request !362
parents 470701b9 6a8e1816
No related branches found
No related tags found
1 merge request!455Update branch with changes from master
......@@ -93,10 +93,23 @@
* If true (default), then when started as a loadable module, replace the
* "# Files Listed" text with an empty string so that it won't be displayed
* after exit
* 2023-11-11 Eric Oulashin Version 2.15a
* On start, if console.aborted is true (due to the user pressing Ctrl-C, etc.),
* then return -1 to stop a file scan in progress.
*/
"use strict";
//js.on_exit("console.ctrlkey_passthru = " + console.ctrlkey_passthru);
//console.ctrlkey_passthru |= (1<<3); // Ctrl-C
//console.ctrlkey_passthru = "+C";
//console.ctrlkey_passthru = "-C";
// If the search action has been aborted, then return -1
if (console.aborted)
exit(-1);
// This script requires Synchronet version 3.19 or newer.
// If the Synchronet version is below the minimum, then exit.
if (system.version_num < 31900)
......@@ -125,9 +138,10 @@ require("scrollbar.js", "ScrollBar");
require("mouse_getkey.js", "mouse_getkey");
require("attr_conv.js", "convertAttrsToSyncPerSysCfg");
// Lister version information
var LISTER_VERSION = "2.15";
var LISTER_DATE = "2023-09-17";
var LISTER_VERSION = "2.15a";
var LISTER_DATE = "2023-11-11";
///////////////////////////////////////////////////////////////////////////////
......@@ -284,7 +298,7 @@ var gBlankNFilesListedStrIfLoadableModule = true;
readConfigFile();
// Parse command-line arguments (which sets program options)
parseArgs(argv);
var gRunningAsLoadableModule = parseArgs(argv);
// If set to use the traditional (non-lightbar) UI and if set to use the Synchronet
// stock file lister, then do so instead of using ddfilelister's traditional UI
......@@ -307,25 +321,29 @@ var gFileList = [];
// filename length and terminal width.
var listPopRetObj = populateFileList(gScriptMode);
if (listPopRetObj.exitNow)
exit(listPopRetObj.exitCode);
exit(0); // listPopRetObj.exitCode
// If there are no files, then say so and exit.
// If there are no files, then say so (if not running as a loadable module) and exit.
console.line_counter = 0;
if (gFileList.length == 0)
{
console.crlf();
console.attributes = "NC";
if (gScriptMode == MODE_LIST_DIR)
if (!gRunningAsLoadableModule)
{
if (gFilespec == "*" || gFilespec == "*.*")
console.print("There are no files in the directory.");
console.crlf();
console.attributes = "NC";
if (gScriptMode == MODE_LIST_DIR)
{
if (gFilespec == "*" || gFilespec == "*.*")
console.print("There are no files in the directory.");
else
console.print("No files in the directory were found matching " + gFilespec);
}
else
console.print("No files in the directory were found matching " + gFilespec);
console.print("No files were found.");
console.attributes = "N";
console.crlf();
//console.pause();
}
else
console.print("No files were found.");
console.attributes = "N";
console.crlf();
console.pause();
exit(0);
}
......@@ -391,27 +409,6 @@ if (gUseLightbarInterface && console.term_supports(USER_ANSI))
// do what's needed. Note that quit (for the Q key) is already handled.
if (actionRetObj != null)
{
/*
// Temporary
if (user.is_sysop)
{
console.print("\x01n\r\n\r\n");
for (var prop in actionRetObj)
{
console.print(prop + ":");
if (typeof(actionRetObj[prop]) === "object")
{
console.crlf();
for (var objProp in actionRetObj[prop])
console.print(" " + objProp + ": " + actionRetObj[prop][objProp] + "\r\n");
}
else
console.print(" " + actionRetObj[prop] + "\r\n");
}
console.pause();
}
// End Temporary
*/
if (actionRetObj.exitNow)
continueDoingFileList = false;
else
......
Digital Distortion File Lister
Version 2.15
Release date: 2023-09-17
Version 2.15a
Release date: 2023-11-11
by
......
......@@ -5,6 +5,9 @@ Revision History (change log)
=============================
Version Date Description
------- ---- -----------
2.15a 2023-11-11 On start, if console.aborted is true (due to the user
pressing Ctrl-C, etc.), then return -1 to stop a file
scan in progress.
2.15 2023-09-17 Fix for "Empty directory" message after quitting (the
lister must exit with the number of files listed). Also,
updates for filename searching. Also, note ddfilelister is
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment