diff options
-rw-r--r-- | CHANGES.txt | 1 | ||||
-rw-r--r-- | src/base/os.lua | 14 | ||||
-rw-r--r-- | tests/base/test_os.lua | 5 |
3 files changed, 13 insertions, 7 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 5403ac3..94b7080 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -21,6 +21,7 @@ * Patch 3063804: Set CompileAs flag for VS200x C projects (rjmyst3) * Implemented StaticRuntime flag for Xcode (William Burnson) * Improved portability of Mac OS X binaries (William Burnson) +* Bug 3035545: The pattern { "./folder/*.c" } matches no files ------- diff --git a/src/base/os.lua b/src/base/os.lua index 303377e..a9a040e 100644 --- a/src/base/os.lua +++ b/src/base/os.lua @@ -81,6 +81,13 @@ -- local function domatch(result, mask, wantfiles) + -- need to remove extraneous path info from the mask to ensure a match + -- against the paths returned by the OS. Haven't come up with a good + -- way to do it yet, so will handle cases as they come up + if mask:startswith("./") then + mask = mask:sub(3) + end + -- strip off any leading directory information to find out -- where the search should take place local basedir = mask @@ -91,13 +98,6 @@ basedir = path.getdirectory(basedir) if (basedir == ".") then basedir = "" end - -- need to remove extraneous path info from the mask to ensure a match - -- against the paths returned by the OS. Haven't come up with a good - -- way to do it yet, so will handle cases as they come up - if mask:startswith("./") then - mask = mask:sub(3) - end - -- recurse into subdirectories? local recurse = mask:find("**", nil, true) diff --git a/tests/base/test_os.lua b/tests/base/test_os.lua index 1fce260..9bcd230 100644 --- a/tests/base/test_os.lua +++ b/tests/base/test_os.lua @@ -73,6 +73,11 @@ test.istrue(table.contains(result, "folder/ok.lua")) test.isfalse(table.contains(result, "folder/ok.lua.2")) end + + function suite.matchfiles_OnLeadingDotSlashWithPath() + local result = os.matchfiles("./folder/*.lua") + test.istrue(table.contains(result, "folder/ok.lua")) + end |