Make it easier to run src/top_evil_rs.py from git root

Currently, `src/top_evil_rs.py' script recursively scans current
directory for Rust sources and print statistics about them.

When run from git root, it also scans target/ directory, which is
useless.

This commit add cludge that checks if script is run from git root
directory, and `chdir' into `src/' before performing actions.

Unprincipled, but convenient.
This commit is contained in:
Dmitry Bogatov
2019-09-10 15:48:08 +00:00
parent e9da21a02e
commit 4fbb5fbb25

View File

@@ -6,6 +6,8 @@ import os
import re
if __name__ == "__main__":
if Path('src/top_evil_rs.py').exists():
os.chdir('src')
filestats = []
for fn in Path(".").glob("**/*.rs"):
s = fn.read_text()