Skip to content

Commit

Permalink
Allow running from root directory as well as from inside the tools di…
Browse files Browse the repository at this point in the history
…rectory
  • Loading branch information
PabstMirror committed Mar 30, 2019
1 parent df3daf4 commit c9e9bf7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
- checkout
- run:
name: Validate SQF and Config style and Stringtable entries
command: python tools/check_strings.py && python tools/sqf_validator.py && python tools/config_style_checker.py
command: python tools/sqf_validator.py && python tools/config_style_checker.py && python tools/check_strings.py

linting:
docker:
Expand Down
7 changes: 6 additions & 1 deletion tools/check_strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ def main(argv):
allDefinedStrings = []
allUsedStrings = []

for root, dirnames, filenames in os.walk('../addons' + '/'):
# Allow running from root directory as well as from inside the tools directory
rootDir = "../addons"

This comment has been minimized.

Copy link
@jonpas

jonpas Mar 31, 2019

Member

You can check how I did that in function header script, going off of script file's location. That way you can run it from anywhere.

if (os.path.exists("addons")):
rootDir = "addons"

for root, dirnames, filenames in os.walk(rootDir):
for filename in fnmatch.filter(filenames, '*.sqf'):
sqf_list.append(os.path.join(root, filename))
for filename in fnmatch.filter(filenames, '*.cpp'):
Expand Down

0 comments on commit c9e9bf7

Please sign in to comment.