mirror of
https://github.com/microsoft/debugpy.git
synced 2025-12-23 08:48:12 +00:00
Allow relative paths and add more logging for path issues
This commit is contained in:
parent
02723de140
commit
a3956e4753
2 changed files with 25 additions and 1 deletions
|
|
@ -653,6 +653,12 @@ def _fix_path(path, sep, add_end_sep=False):
|
|||
|
||||
if sep != "/":
|
||||
path = path.replace("/", sep)
|
||||
|
||||
if path.startswith("."):
|
||||
# We need the full path if this relative because all comparisons below
|
||||
# check if the path is substring of another
|
||||
path = os.path.realpath(path)
|
||||
|
||||
return path
|
||||
|
||||
|
||||
|
|
@ -747,6 +753,16 @@ def setup_client_server_paths(paths):
|
|||
initial_paths_with_end_sep.append((path0, path1))
|
||||
paths_from_eclipse_to_python_with_end_sep.append((_normcase_from_client(path0), normcase(path1)))
|
||||
|
||||
if DEBUG_CLIENT_SERVER_TRANSLATION:
|
||||
pydev_log.critical(
|
||||
"pydev debugger: paths_from_eclipse_to_python %s",
|
||||
", ".join(
|
||||
[
|
||||
'"%s=>%s"' % (x[0], x[1])
|
||||
for x in paths_from_eclipse_to_python
|
||||
]
|
||||
),
|
||||
)
|
||||
# Fix things so that we always match the versions with a slash in the end first.
|
||||
initial_paths = initial_paths_with_end_sep + initial_paths
|
||||
paths_from_eclipse_to_python = paths_from_eclipse_to_python_with_end_sep + paths_from_eclipse_to_python
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ def test_source_reference(tmpdir):
|
|||
# Client on windows and server on unix
|
||||
pydevd_file_utils.set_ide_os("WINDOWS")
|
||||
|
||||
pydevd_file_utils.setup_client_server_paths([("c:\\foo", "/bar")])
|
||||
pydevd_file_utils.setup_client_server_paths([("C:\\foo", "/bar")])
|
||||
|
||||
assert pydevd_file_utils.map_file_to_client("/bar/my") == ("c:\\foo\\my", True)
|
||||
assert pydevd_file_utils.get_client_filename_source_reference("c:\\foo\\my") == 0
|
||||
|
|
@ -160,6 +160,14 @@ def test_source_reference(tmpdir):
|
|||
assert source_reference != 0
|
||||
assert pydevd_file_utils.get_server_filename_from_source_reference(source_reference) == "/another/my"
|
||||
|
||||
# Allow relative paths in the server path
|
||||
pydevd_file_utils.setup_client_server_paths([("C:\\foo", "./bar")])
|
||||
root = os.getcwd()
|
||||
server_path = os.path.join(root, "bar/my")
|
||||
|
||||
assert pydevd_file_utils.map_file_to_client(server_path) == ("c:\\foo\\my", True)
|
||||
assert pydevd_file_utils.get_client_filename_source_reference("c:\\foo\\my") == 0
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.platform != "win32", reason="Windows-only test.")
|
||||
def test_translate_only_drive():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue