Skip to content

Commit 256a7ee

Browse files
committed
better path handling
1 parent 4db4259 commit 256a7ee

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tex_writing_issues/rule_builder.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import custom_log as l
22
import os
33
from typing import List
4-
4+
from pathlib import Path
55

66
def get_rules() -> List:
77
all_rules = _build_rules(["ambiguous", "complicated", "offensive", "strong"])
@@ -10,15 +10,16 @@ def get_rules() -> List:
1010

1111

1212
def _build_rules(rule_names: List) -> List:
13-
path_rules = "/home/amit/git/automating-boring-tasks-using-python/tex_writing_issues/"
13+
HOME = str(Path.home())
14+
path_rules = HOME+"/git/automating-boring-tasks-using-python/tex_writing_issues/"
1415
all_rules: List = []
1516
for rule_name in rule_names:
1617
l.log("working with rule: " + rule_name)
1718
f_rule = path_rules + "words_" + rule_name
1819
l.log("rule file name: " + f_rule)
1920
current_rules: List = []
2021
if not os.path.exists(f_rule):
21-
l.log("file_rule {} NOT FOUND. EXITING".format(f_rule))
22+
print("file_rule {} NOT FOUND. EXITING".format(f_rule))
2223
exit()
2324

2425
l.log("path to rule: " + f_rule)

0 commit comments

Comments
 (0)