Skip to content

Commit c7cca52

Browse files
smithsg84Sarcasm
authored andcommitted
irony-cdb: follow symbolic links for filename comparison (#542)
Use file-truename to detect the source file when adjusting the compile options.
1 parent c3ae899 commit c7cca52

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

irony-cdb-json.el

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,8 @@ should be used since elements can change at the head.
240240
Removes the input file, the output file, ...
241241
242242
Relative paths are relative to DEFAULT-DIR."
243-
;; compute the absolute path for FILE only once
244-
(setq file (expand-file-name file default-dir))
243+
;; compute the truename of the absolute path for FILE only once
244+
(setq file (file-truename (expand-file-name file default-dir)))
245245
(let* ((head (cons 'nah compile-options))
246246
(it head)
247247
opt)
@@ -258,8 +258,8 @@ Relative paths are relative to DEFAULT-DIR."
258258
(if (string= opt "-o")
259259
(setcdr it (nthcdr 3 it))
260260
(setcdr it (nthcdr 2 it))))
261-
;; skip input file
262-
((string= file (expand-file-name opt default-dir))
261+
;; skip input file; avoid invoking file commands if an option argument
262+
((and (not (string-prefix-p "-" opt)) (string= file (file-truename (expand-file-name opt default-dir))))
263263
(setcdr it (nthcdr 2 it)))
264264
(t
265265
;; if head of cdr hasn't been skipped, iterate, otherwise check if the

0 commit comments

Comments
 (0)