mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-07-16 08:46:26 +00:00
Properly handle relative symlinks when publishing
* org-publish.el (org-publish-cache-ctime-of-src): Properly handle relative symlinks. At Thu, 07 Apr 2011 01:11:00 -0400, Nick Dokos wrote: > > org-publish-cache-ctime-of-src tries (but does not always succeed) to > deal with symlinks: file-symlink-p returns the target as a string, but > if the target is relative to the symlink, that's not going to fly. > e.g. if c is a symlink like this > > /a/b/c->../d/f > > then (file-symlink-p "/a/b/c") -> "../d/f" > but if the current directory is any place other than /a/b, the target > will not be found, the file attributes are going to be nil and > the function will blow up.
This commit is contained in:
parent
c4066dca8e
commit
60d24c01ea
|
@ -1157,9 +1157,12 @@ Returns value on success, else nil."
|
|||
|
||||
(defun org-publish-cache-ctime-of-src (filename)
|
||||
"Get the FILENAME ctime as an integer."
|
||||
(let ((src-attr (file-attributes (if (stringp (file-symlink-p filename))
|
||||
(file-symlink-p filename)
|
||||
filename))))
|
||||
(let* ((symlink-maybe (or (file-symlink-p filename) filename))
|
||||
(src-attr (file-attributes (if (file-name-absolute-p symlink-maybe)
|
||||
symlink-maybe
|
||||
(expand-file-name
|
||||
symlink-maybe
|
||||
(file-name-directory filename))))))
|
||||
(+
|
||||
(lsh (car (nth 5 src-attr)) 16)
|
||||
(cadr (nth 5 src-attr)))))
|
||||
|
|
Loading…
Reference in a new issue