Skip to content

Commit 6b66ee6

Browse files
committed
Use relative filepaths so differing envs play nice
If you're running your environment and your phpunit stack within vagrant, your base paths between your ide and what phpunit will generate will differ (ie, /path/to/my/code/my/project vs /vagrant). This commit alters the plugin to compare the tail end of the relative paths rather than do strict path comparison, which gives just enough leeway to cope with this scenario. Would have used ends-with but thats not available in this implementation of xpath apparently.
1 parent f7224ea commit 6b66ee6

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

plugin/python/codecoverage.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ except NameError:
1616

1717
clover = vim.eval('a:clover')
1818
buf = vim.eval('bufname("%")')
19-
fileName = vim.eval('fnamemodify("'+buf+'",":p")')
19+
fileName = vim.eval('fnamemodify("'+buf+'","%")')
2020

2121
"""
2222
XML may already be parsed and held in memory
@@ -41,7 +41,7 @@ try:
4141
mtime = time.ctime(os.path.getmtime(clover))
4242

4343
ctxt = doc.xpathNewContext()
44-
res = ctxt.xpathEval("//file[@name='"+fileName+"']/line[@type='stmt']")
44+
res = ctxt.xpathEval("//file[substring(@name, string-length(@name) - string-length('"+fileName+"') + 1)='"+fileName+"']/line[@type='stmt']")
4545
cur_signs = int(vim.eval('g:phpqa_num_cc_signs'))
4646
showcovered = int(vim.eval('g:phpqa_codecoverage_showcovered'))
4747
cmd_list = ''

0 commit comments

Comments
 (0)