diff --git a/py/path/local/local.py b/py/path/local/local.py index 57f2e2cdb..4c432d804 100644 --- a/py/path/local/local.py +++ b/py/path/local/local.py @@ -514,6 +514,8 @@ class LocalPath(common.FSPathBase, PlatformMixin): else: if iswin32: paths = py.std.os.environ['Path'].split(';') + if '' not in paths and '.' not in paths: + paths.append('.') try: systemroot = os.environ['SYSTEMROOT'] except KeyError: diff --git a/py/path/local/testing/test_win.py b/py/path/local/testing/test_win.py index 12d6377b6..f9ad92112 100644 --- a/py/path/local/testing/test_win.py +++ b/py/path/local/testing/test_win.py @@ -42,4 +42,15 @@ class TestWINLocalPath: assert t1 == str(self.root) + '\\a_path' t1 = self.root.join('dir/a_path') assert t1 == str(self.root) + '\\dir\\a_path' - + + def test_sysfind_in_currentdir(self): + cmd = py.path.local.sysfind('cmd') + root = cmd.new(dirname='', basename='') # c:\ in most installations + + old = root.chdir() + try: + x = py.path.local.sysfind(cmd.relto(root)) + assert x.check(file=1) + finally: + old.chdir() +