Skip to content
Snippets Groups Projects
Verified Commit dd16a25d authored by Laurent Heirendt's avatar Laurent Heirendt :airplane:
Browse files

fix directory

parent 41c7b890
No related branches found
No related tags found
No related merge requests found
......@@ -11,15 +11,7 @@ from generator import helper, format
def save_tag(localroot, root, filename, tag):
return_tag = ""
try:
os.chdir(root)
print("Current working directory: {0}".format(os.getcwd()))
except FileNotFoundError:
print("Directory: {0} does not exist".format(root))
except NotADirectoryError:
print("{0} is not a directory".format(root))
except PermissionError:
print("You do not have permissions to change to {0}".format(root))
os.chdir(root)
length_tag = len(tag)
......@@ -89,7 +81,6 @@ def save_legacy_from(localroot, root, filename):
def get_title(localroot, root, file):
os.chdir(root)
qms_yml = False
yml_file = ""
......@@ -101,11 +92,14 @@ def get_title(localroot, root, file):
else:
print("QMS document is not formatted properly.")
elif "handbook" in root:
os.chdir(root)
with open(file, 'r') as f:
for line in f:
if re.search(r"^#+\ .*$", line):
title = line
break
# change back to the local root
os.chdir(localroot)
else:
title = save_tag(localroot, root, file, "title")
......@@ -113,9 +107,6 @@ def get_title(localroot, root, file):
title = title.replace("# ", "")
title = title.rstrip("\n\r")
# change back to the local root
os.chdir(localroot)
return title, qms_yml, yml_file
def get_sections(cardDirs):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment