Skip to content

Commit a78e5c2

Browse files
authored
Fix path modification for windows filesystems that can't handle .. (#1752)
1 parent 3823aba commit a78e5c2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/debugpy/adapter/__main__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,13 @@ def _parse_argv(argv):
211211
# future imports of it or its submodules will resolve accordingly.
212212
if "debugpy" not in sys.modules:
213213
# Do not use dirname() to walk up - this can be a relative path, e.g. ".".
214-
sys.path[0] = sys.path[0] + "/../../"
214+
if os.name == "nt":
215+
import pathlib
216+
217+
windows_path = pathlib.Path(sys.path[0])
218+
sys.path[0] = str(windows_path.parent.parent)
219+
else:
220+
sys.path[0] = sys.path[0] + "/../../"
215221
__import__("debugpy")
216222
del sys.path[0]
217223

0 commit comments

Comments
 (0)