Skip to content

Commit

Permalink
automatically include local directory
Browse files Browse the repository at this point in the history
If there is a directory specified in the filename we automatically
add the directory the file is in as the include directory.
  • Loading branch information
regit committed Apr 1, 2020
1 parent 41b934f commit a1d9e9b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/coccigrep.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,11 @@ def run(self, files):
cmd = [self.spatch]
cmd += self.options
cmd += ["-sp_file", tmp_cocci_file.name]
for cfile in fseq:
include_dir = path.dirname(cfile)
if len(include_dir):
cmd += ["-I", include_dir]
break
cmd += sub_files
sprocess = CocciProcess(cmd, self.verbose)
sprocess.start()
Expand All @@ -522,6 +527,9 @@ def run(self, files):
cmd += self.options
cmd += ["-sp_file", tmp_cocci_file.name]
cmd += files
include_dir = path.dirname(files[0])
if len(include_dir):
cmd += ["-I", include_dir]
try:
if self.verbose:
stderr.write("Running: %s.\n" % " ".join(cmd))
Expand Down

0 comments on commit a1d9e9b

Please sign in to comment.