Skip to content

Commit 0f8c02a

Browse files
committed
Handle the case where only a drive is given for the translation. debugpy:770
1 parent 8c3bfec commit 0f8c02a

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

pydevd_file_utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ def _get_path_with_real_case(filename):
218218
parts = parts.lower().split(os.path.sep)
219219

220220
try:
221+
if parts == ['']:
222+
return drive
221223
return _resolve_listing(drive, iter(parts))
222224
except FileNotFoundError:
223225
_listdir_cache.clear()

tests_python/test_convert_utilities.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import io
66
from _pydev_bundle.pydev_log import log_context
77
import pytest
8+
import sys
89

910

1011
def test_convert_utilities(tmpdir):
@@ -99,6 +100,12 @@ def test_source_reference(tmpdir):
99100
assert pydevd_file_utils.get_server_filename_from_source_reference(source_reference) == '/another/my'
100101

101102

103+
@pytest.mark.skipif(sys.platform != 'win32', reason='Windows-only test.')
104+
def test_translate_only_drive():
105+
import pydevd_file_utils
106+
assert pydevd_file_utils.get_path_with_real_case('c:\\') == 'C:\\'
107+
108+
102109
def test_to_server_and_to_client(tmpdir):
103110
try:
104111

0 commit comments

Comments
 (0)