Fix path modification for windows filesystems that can't handle .. (#1752)

This commit is contained in:
Luke Riddle 2024-12-03 13:09:32 -05:00 committed by GitHub
parent 3823aba95e
commit a78e5c28cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -211,7 +211,13 @@ if __name__ == "__main__":
# future imports of it or its submodules will resolve accordingly.
if "debugpy" not in sys.modules:
# Do not use dirname() to walk up - this can be a relative path, e.g. ".".
sys.path[0] = sys.path[0] + "/../../"
if os.name == "nt":
import pathlib
windows_path = pathlib.Path(sys.path[0])
sys.path[0] = str(windows_path.parent.parent)
else:
sys.path[0] = sys.path[0] + "/../../"
__import__("debugpy")
del sys.path[0]