lib: sort the matched include files lexicographically
Now the files are included in the same order as they would be listed by 'ls'.
This commit is contained in:
parent
e8c362e3e5
commit
f2c1586238
@ -208,8 +208,9 @@ includedirectivep = do
|
|||||||
fileglob <- case tryCompileWith compDefault{errorRecovery=False} filename of
|
fileglob <- case tryCompileWith compDefault{errorRecovery=False} filename of
|
||||||
Right x -> pure x
|
Right x -> pure x
|
||||||
Left e -> parseErrorAt parserpos $ "Invalid glob pattern: " ++ e
|
Left e -> parseErrorAt parserpos $ "Invalid glob pattern: " ++ e
|
||||||
-- Get all matching files in the current working directory
|
-- Get all matching files in the current working directory, sorting in
|
||||||
filepaths <- liftIO $ globDir1 fileglob curdir
|
-- lexicographic order to simulate the output of 'ls'.
|
||||||
|
filepaths <- liftIO $ sort <$> globDir1 fileglob curdir
|
||||||
if (not . null) filepaths
|
if (not . null) filepaths
|
||||||
then pure filepaths
|
then pure filepaths
|
||||||
else parseErrorAt parserpos$ "No existing files match pattern: " ++ filename
|
else parseErrorAt parserpos$ "No existing files match pattern: " ++ filename
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user