Skip to content

Commit 6d49ef9

Browse files
committed
Python's builtin os.walk
Using python's builtin os.walk to look for remap files instead of shell command output string parsing.
1 parent d079068 commit 6d49ef9

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

Diff for: utils/apply-fixit-edits.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,14 @@
1717
import json
1818
import argparse
1919
import sys
20+
import os
2021

2122
def find_remap_files(path):
22-
out = None
23-
try:
24-
out = subprocess.check_output(["find", path, "-name", "*.remap"])
25-
except subprocess.CalledProcessError:
26-
return None
27-
lines = out.split('\n')
28-
lines.pop(-1)
29-
return lines
23+
for root, dirs, files in os.walk(path):
24+
for filename in files:
25+
if not filename.endswith(".remap"):
26+
continue
27+
yield os.path.join(root, filename)
3028

3129
def apply_edits(path):
3230
remap_files = find_remap_files(path)

0 commit comments

Comments
 (0)