summaryrefslogtreecommitdiff
path: root/src/pyssg/discovery.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/pyssg/discovery.py')
-rw-r--r--src/pyssg/discovery.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/pyssg/discovery.py b/src/pyssg/discovery.py
index 39c8bb1..606c1d0 100644
--- a/src/pyssg/discovery.py
+++ b/src/pyssg/discovery.py
@@ -11,7 +11,7 @@ def get_file_list(extensions: list[str], exclude: list[str]=None) -> list[str]:
for f in files:
if f.endswith(tuple(extensions)):
- out.append(os.path.join(root, f))
+ out.append(os.path.join(root, f).replace(cwd, '')[1:])
return out
@@ -27,14 +27,19 @@ def get_dir_structure(exclude: list[str]=None) -> list[str]:
for d in dirs:
if root in out:
out.remove(root)
- out.append(os.path.join(root, d).replace(cwd, ''))
+ out.append(os.path.join(root, d))
+
+ return [o.replace(cwd, '')[1:] for o in out]
- return out
+def get_all_files(src: str) -> tuple[list[str], list[str], list[str]]:
+ iwd = os.getcwd()
+ os.chdir(src)
-def get_all_files():
md_files = get_file_list(['.md', '.markdown'], ['templates'])
html_files = get_file_list(['.html'], ['templates'])
dirs = get_dir_structure(['templates'])
+ os.chdir(iwd)
+
return (dirs, md_files, html_files)