Skip to content
Browse files

Fix for local win paths

  • Loading branch information...
1 parent 412293b commit e4732b8d96eac8ab91afa68543343f7058608b75 @joonty committed
Showing with 14 additions and 2 deletions.
  1. +5 −2 plugin/python/vdebug/util.py
  2. +9 −0 tests/test_util_filepath.py
View
7 plugin/python/vdebug/util.py
@@ -69,8 +69,6 @@ def __init__(self,filename):
self.is_win = True
if filename[0] == "/":
filename = filename[1:]
- if filename[2] == "\\":
- filename = filename.replace("\\","/")
self.local = self._create_local(filename)
self.remote = self._create_remote(filename)
@@ -81,6 +79,9 @@ def _create_local(self,f):
Uses the "local_path" and "remote_path" options.
"""
ret = f
+ if ret[2] == "/":
+ ret = ret.replace("/","\\")
+
if vdebug.opts.Options.isset('path_maps'):
for remote, local in vdebug.opts.Options.get('path_maps', dict).items():
if remote in ret:
@@ -97,6 +98,8 @@ def _create_remote(self,f):
Uses the "local_path" and "remote_path" options.
"""
ret = f
+ if ret[2] == "\\":
+ ret = ret.replace("\\","/")
if vdebug.opts.Options.isset('path_maps'):
for remote, local in vdebug.opts.Options.get('path_maps', dict).items():
View
9 tests/test_util_filepath.py
@@ -26,6 +26,11 @@ def test_quoted(self):
file = FilePath(quoted)
self.assertEqual("/home/user/file.tcl",file.as_local())
+ def test_win(self):
+ quoted = "file:///C:/home/user/file%2etcl"
+ file = FilePath(quoted)
+ self.assertEqual("C:\\home\\user\\file.tcl",file.as_local())
+
def test_as_remote(self):
filename = "/home/user/some/path"
file = FilePath(filename)
@@ -125,3 +130,7 @@ def test_as_remote_with_backslashed_win_paths(self):
filename = "C:\\local2\\path\\to\\file"
file = FilePath(filename)
self.assertEqual("file:///C:/remote2/path/to/file",file.as_remote())
+
+ filename = "C:/local2/path/to/file"
+ file = FilePath(filename)
+ self.assertEqual("C:\\local2\\path\\to\\file",file.as_local())

0 comments on commit e4732b8

Please sign in to comment.
Something went wrong with that request. Please try again.