fix(windows+py3.9): fixed an issue on windows with py3.9 and stdin

On windows python 3.9 the stdin path of - was "sometimes" recognized as the cwd, and sometimes as
the system root. This update sets the cwd manually for paths of -.

re https://github.com/monosans/djlint-vscode/issues/83
This commit is contained in:
Christopher Pickering 2022-10-21 09:14:18 +02:00
parent 4a0bee6dc2
commit 280e1fc29c
No known key found for this signature in database
GPG key ID: E14DB3B0A0FACF84

View file

@ -220,7 +220,10 @@ class Config:
self.lint = lint
self.warn = warn
self.project_root = find_project_root(Path(src))
if src == "-":
self.project_root = find_project_root(Path.cwd())
else:
self.project_root = find_project_root(Path(src))
djlint_settings = load_project_settings(self.project_root, configuration)