From 8d258241e70215653ab3ce4c4e263ac4480c6bb6 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Wed, 19 Jan 2022 20:23:05 -0800 Subject: [PATCH] Let pathclass.glob('.') return cwd. This brings it more in line with regular glob for which glob('.') = ['.']. --- voussoirkit/pathclass.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/voussoirkit/pathclass.py b/voussoirkit/pathclass.py index 9d1c574..0011707 100644 --- a/voussoirkit/pathclass.py +++ b/voussoirkit/pathclass.py @@ -620,6 +620,12 @@ def glob(pattern): If you want to recurse, consider using spinal.walk with glob_filenames instead. ''' + if pattern == '.': + return [cwd()] + + elif pattern == '..': + return [cwd().parent] + (dirname, pattern) = os.path.split(pattern) return Path(dirname).glob(pattern)