We need to set the IDE os because the host where the code is running may be actually different from the client (and the point is that we want the proper paths to translate from the client to the server). :param os: 'UNIX' or 'WINDOWS'
(os)
| 367 | |
| 368 | |
| 369 | def set_ide_os(os): |
| 370 | """ |
| 371 | We need to set the IDE os because the host where the code is running may be |
| 372 | actually different from the client (and the point is that we want the proper |
| 373 | paths to translate from the client to the server). |
| 374 | |
| 375 | :param os: |
| 376 | 'UNIX' or 'WINDOWS' |
| 377 | """ |
| 378 | global _ide_os |
| 379 | global _normcase_from_client |
| 380 | prev = _ide_os |
| 381 | if os == "WIN": # Apparently PyCharm uses 'WIN' (https://github.com/fabioz/PyDev.Debugger/issues/116) |
| 382 | os = "WINDOWS" |
| 383 | |
| 384 | assert os in ("WINDOWS", "UNIX") |
| 385 | |
| 386 | if DEBUG_CLIENT_SERVER_TRANSLATION: |
| 387 | print("pydev debugger: client OS: %s" % (os,)) |
| 388 | |
| 389 | _normcase_from_client = normcase |
| 390 | if os == "WINDOWS": |
| 391 | # Client in Windows and server in Unix, we need to normalize the case. |
| 392 | if not IS_WINDOWS: |
| 393 | _normcase_from_client = _normcase_windows |
| 394 | |
| 395 | else: |
| 396 | # Client in Unix and server in Windows, we can't normalize the case. |
| 397 | if IS_WINDOWS: |
| 398 | _normcase_from_client = _normcase_linux |
| 399 | |
| 400 | if prev != os: |
| 401 | _ide_os = os |
| 402 | # We need to (re)setup how the client <-> server translation works to provide proper separators. |
| 403 | setup_client_server_paths(_last_client_server_paths_set) |
| 404 | |
| 405 | |
| 406 | # Caches filled as requested during the debug session. |