From 673caef86219b8d36e72d104eaee9fc4b2db3854 Mon Sep 17 00:00:00 2001 From: Jorj Bauer Date: Wed, 7 Feb 2018 14:05:37 -0500 Subject: [PATCH] abstracting directory filename filter --- bios.cpp | 6 +++--- bios.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bios.cpp b/bios.cpp index 581302d..2161da9 100644 --- a/bios.cpp +++ b/bios.cpp @@ -708,7 +708,7 @@ void BIOS::stripDirectory() void BIOS::DrawDiskNames(uint8_t page, int8_t selection) { - uint8_t fileCount = GatherFilenames(page); + uint8_t fileCount = GatherFilenames(page, "dsk,.po,nib,img"); g_display->clrScr(); g_display->drawString(M_NORMAL, 0, 12, "BIOS Configuration - pick disk"); @@ -739,14 +739,14 @@ void BIOS::DrawDiskNames(uint8_t page, int8_t selection) } -uint8_t BIOS::GatherFilenames(uint8_t pageOffset) +uint8_t BIOS::GatherFilenames(uint8_t pageOffset, const char *filter) { uint8_t startNum = 10 * pageOffset; uint8_t count = 0; // number we're including in our listing while (1) { char fn[BIOS_MAXPATH]; - int8_t idx = g_filemanager->readDir(rootPath, "dsk,.po,nib,img", fn, startNum + count, BIOS_MAXPATH); + int8_t idx = g_filemanager->readDir(rootPath, filter, fn, startNum + count, BIOS_MAXPATH); if (idx == -1) { return count; diff --git a/bios.h b/bios.h index b3a72db..d075a4c 100644 --- a/bios.h +++ b/bios.h @@ -37,7 +37,7 @@ class BIOS { bool SelectDiskImage(); void DrawDiskNames(uint8_t page, int8_t selection); - uint8_t GatherFilenames(uint8_t pageOffset); + uint8_t GatherFilenames(uint8_t pageOffset, const char *filter); void stripDirectory();