Skip to content

Commit 78a23bb

Browse files
committed
Fix removal of first component
Removal of first component for header guard suggestion is hard-coded to remove 4 characters ("src/"). This doesn't work with all directory names ("unit/").
1 parent e0b4515 commit 78a23bb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

scripts/cpplint.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1967,7 +1967,9 @@ def GetHeaderGuardCPPVariable(filename):
19671967

19681968
fileinfo = FileInfo(filename)
19691969
file_path_from_root = fileinfo.RepositoryName()
1970-
file_path_from_root = 'CPROVER_' + file_path_from_root[4:]
1970+
# Remove first path component
1971+
offset=len(file_path_from_root.split(os.path.sep)[0])+1
1972+
file_path_from_root = 'CPROVER_' + file_path_from_root[offset:]
19711973
if _root:
19721974
suffix = os.sep
19731975
# On Windows using directory separator will leave us with

0 commit comments

Comments
 (0)