Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix common prefix detection for files #103

Merged
merged 1 commit into from Aug 6, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion scripts/gcovr
Expand Up @@ -1456,6 +1456,7 @@ def print_html_report(covdata, details):
# Generate the coverage output (on a per-package basis)
#source_dirs = set()
files = []
dirs = []
filtered_fname = ''
keys = list(covdata.keys())
keys.sort(
Expand All @@ -1466,6 +1467,7 @@ def print_html_report(covdata, details):
cdata = covdata[f]
filtered_fname = options.root_filter.sub('', f)
files.append(filtered_fname)
dirs.append(os.path.dirname(filtered_fname) + os.sep)
cdata._filename = filtered_fname
ttmp = os.path.abspath(options.output).split('.')
if len(ttmp) > 1:
Expand All @@ -1479,7 +1481,7 @@ def print_html_report(covdata, details):
# Define the common root directory, which may differ from options.root
# when source files share a common prefix.
if len(files) > 1:
commondir = posixpath.commonprefix(files)
commondir = os.path.commonprefix(dirs)
if commondir != '':
data['DIRECTORY'] = commondir
else:
Expand Down