mirror of
https://github.com/CorsixTH/CorsixTH.git
synced 2025-07-23 04:13:01 +02:00
scripts: use os.path to form paths
This commit is contained in:
@@ -25,13 +25,13 @@ if len(sys.argv) > 2:
|
||||
|
||||
top = os.getcwd()
|
||||
if len(sys.argv) == 2:
|
||||
top += '/' + sys.argv[1]
|
||||
top = os.path.join(top, sys.argv[1])
|
||||
|
||||
offending_files = []
|
||||
for root, dirs, files in os.walk(top):
|
||||
for f in files:
|
||||
if f.endswith('.lua'):
|
||||
path = root + '/' + f
|
||||
path = os.path.join(root, f)
|
||||
if is_BOM_encoded_file(path):
|
||||
offending_files.append(f)
|
||||
|
||||
|
@@ -11,13 +11,13 @@ import sys
|
||||
regex = r"^class \"(.+)\".*\n\n(?!---@type \1\nlocal \1 = _G\[\"\1\"])"
|
||||
|
||||
print_root_regex = re.compile("Lua.*")
|
||||
script_dir = os.getcwd() + "/../CorsixTH/Lua"
|
||||
ignored = os.listdir(script_dir + "/languages")
|
||||
script_dir = os.path.join(os.path.dirname(__file__), "..", "CorsixTH", "Lua")
|
||||
ignored = os.listdir(os.path.join(script_dir, "languages"))
|
||||
problem_found = False
|
||||
for root, _, files in os.walk(script_dir):
|
||||
for script in files:
|
||||
if script.endswith(".lua") and script not in ignored:
|
||||
script_string = open(root + "/" + script, 'r').read()
|
||||
script_string = open(os.path.join(root, script), 'r').read()
|
||||
for found_class in re.findall(regex, script_string, re.MULTILINE):
|
||||
if not problem_found:
|
||||
print("******* CHECK CLASS DECLARATIONS *******")
|
||||
|
@@ -32,12 +32,12 @@ if len(sys.argv) > 2:
|
||||
|
||||
top = os.getcwd()
|
||||
if len(sys.argv) == 2:
|
||||
top += '/' + sys.argv[1]
|
||||
top = os.path.join(top, sys.argv[1])
|
||||
|
||||
for root, dirs, files in os.walk(top):
|
||||
for f in files:
|
||||
if f.endswith(('.py', '.lua', '.h', '.cpp', '.cc', '.c')):
|
||||
path = root + '/' + f
|
||||
path = os.path.join(root, f)
|
||||
if has_trailing_whitespaces(path):
|
||||
sys.exit('Found a file with trailing whitespaces: ' + path)
|
||||
|
||||
|
Reference in New Issue
Block a user