Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
ANDROID: Reland "gen_compile_commands.py: fix path resolve with symli…
Browse files Browse the repository at this point in the history
…nks in it"

This reverts commit 2285818.

Reason for revert: Re-landing after hacking Kleaf script.

Bug: 320449031
Change-Id: I8aa2783b77f13859798cf7b075e3f1656038315e
Signed-off-by: Ulises Mendez Martinez <umendez@google.com>
  • Loading branch information
Ulises Mendez Martinez authored and Treehugger Robot committed Feb 8, 2024
1 parent 4323574 commit b41110b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/clang-tools/gen_compile_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def parse_arguments():
args = parser.parse_args()

return (args.log_level,
os.path.abspath(args.directory),
os.path.realpath(args.directory),
args.output,
args.ar,
args.paths if len(args.paths) > 0 else [args.directory])
Expand Down Expand Up @@ -172,8 +172,8 @@ def process_line(root_directory, command_prefix, file_path):
# by Make, so this code replaces the escaped version with '#'.
prefix = command_prefix.replace('\#', '#').replace('$(pound)', '#')

# Use os.path.abspath() to normalize the path resolving '.' and '..' .
abs_path = os.path.abspath(os.path.join(root_directory, file_path))
# Return the canonical path, eliminating any symbolic links encountered in the path.
abs_path = os.path.realpath(os.path.join(root_directory, file_path))
if not os.path.exists(abs_path):
raise ValueError('File %s not found' % abs_path)
return {
Expand Down

0 comments on commit b41110b

Please sign in to comment.