[code][textadept] file filtering

From: Peter Rolf <indiego.att.gmx.net>
Date: Tue, 9 Apr 2019 16:44:56 +0200

Hi Mitchell,

I am using "lfs.dir_foreach()" to scan a directory tree for "*.json"
files. This works fast and reliable, but the lack of an include
parameter for file filtering forces me to exclude all other existing
file types by listing them in the filter.

-- filter parameter for the file scan;
local filter = {
        -- ".json", -- results in immediate termination
        -- file extensions to exclude
        "!.bmp", "!.dds", "!.dll", "!.jpg", "!.html", "!.png", "!.txt",
"!.exe", "!.info",
        -- directories to exclude
        -- exclude some vanilla data to reduce data mess (multiple data with
same ID);
        -- only the files in "Mods" contain the complete data (e.g. <Custom>)
        "!/data/mech$", "!/data/chassis$", "!/data/vehicle$",
"!/data/vehicleChassis$", "!/data/ammunitionBox$",
        -- not needed for the PDF
        "!/cast$", "!/contract$",
        "!/emblem$", "!/events$",
        "!/pilot$", "!/portrait", "!/portraits$",
        "!/shipUpgrades$", "!/shops$", "!/sprites$",
        "!/textures$", "!/traits$", "!/turretpilots$",

How can I include a specific file extension?
And if that is not possible: can you add an include feature for the filter?

Cheers, Peter

You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Tue 09 Apr 2019 - 10:44:56 EDT

This archive was generated by hypermail 2.2.0 : Wed 10 Apr 2019 - 06:45:34 EDT