Skip to content

Commit

Permalink
Merge pull request #1254 from mathics/sortedFileNames
Browse files Browse the repository at this point in the history
Sorted file names
  • Loading branch information
mmatera authored Apr 10, 2021
2 parents e3ba2fd + 69a9c7c commit 51ff48b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Enhancements
* ``Table`` [*expr*, *n*] is supported.
* ``ToString`` accepts an optional *form* parameter.
* ``ToExpression`` handles multi-line string input
* ``FileNames`` returns a sorted list (#1250).

Bug fixes
+++++++++
Expand Down
4 changes: 1 addition & 3 deletions mathics/builtin/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -4201,7 +4201,6 @@ def apply(self, filename, datelist, attribute, evaluation):
if py_attr == "All":
os.utime(py_filename, (stattime, stattime))
except OSError as e:
print(e)
# evaluation.message(...)
return SymbolFailed

Expand Down Expand Up @@ -5214,7 +5213,6 @@ def apply_3(self, forms, paths, n, evaluation, **options):
elif n.get_head_name() == "System`DirectedInfinity":
n = None
else:
print(n)
evaluation.message("FileNames", "badn", n)
return
else:
Expand Down Expand Up @@ -5262,4 +5260,4 @@ def apply_3(self, forms, paths, n, evaluation, **options):
filenames.add(osp.join(root, fn))
break

return Expression("List", *[String(s) for s in filenames])
return Expression("List", *[String(s) for s in sorted(filenames)])

0 comments on commit 51ff48b

Please sign in to comment.