Stop returning dotted directory names in os.matchdirs()
This commit is contained in:
parent
f4e55da621
commit
cb0aba47f3
@ -220,7 +220,6 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
function os.match(mask, matchFiles)
|
function os.match(mask, matchFiles)
|
||||||
|
|
||||||
-- Strip any extraneous weirdness from the mask to ensure a good
|
-- Strip any extraneous weirdness from the mask to ensure a good
|
||||||
-- match against the paths returned by the OS. I don't know if I've
|
-- match against the paths returned by the OS. I don't know if I've
|
||||||
-- caught all the possibilities here yet; will add more as I go.
|
-- caught all the possibilities here yet; will add more as I go.
|
||||||
@ -256,9 +255,12 @@
|
|||||||
while os.matchnext(m) do
|
while os.matchnext(m) do
|
||||||
local isfile = os.matchisfile(m)
|
local isfile = os.matchisfile(m)
|
||||||
if (matchFiles and isfile) or (not matchFiles and not isfile) then
|
if (matchFiles and isfile) or (not matchFiles and not isfile) then
|
||||||
local fname = path.join(basedir, os.matchname(m))
|
local fname = os.matchname(m)
|
||||||
if fname:match(mask) == fname then
|
if isfile or not fname:startswith(".") then
|
||||||
table.insert(result, fname)
|
fname = path.join(basedir, fname)
|
||||||
|
if fname:match(mask) == fname then
|
||||||
|
table.insert(result, fname)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -40,6 +40,17 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- os.matchdirs() tests
|
||||||
|
--
|
||||||
|
|
||||||
|
function suite.matchdirs_skipsDottedDirs()
|
||||||
|
local result = os.matchdirs("*")
|
||||||
|
test.isfalse(table.contains(result, ".."))
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- os.matchfiles() tests
|
-- os.matchfiles() tests
|
||||||
--
|
--
|
||||||
|
Loading…
Reference in New Issue
Block a user