From b5b3e36d04fe1a35c9ffc5671b1351394783fbf6 Mon Sep 17 00:00:00 2001
From: Urs Liska
Date: Thu, 2 Jun 2016 16:17:41 +0200
Subject: [PATCH] #4877: Revert #4747: (Remove (all) uses of is-absolute?)
This reverts
commit f30a8189adbbeefa2103e2c2e194040f66bc2291
Author: Urs Liska
Date: Tue Jan 19 10:52:33 2016 +0100
#4747: Remove (all) uses of is-absolute?
====================
As discussion revealed the commit message is not true
and indicates a misconception.
(car ly:input-file-line-char-column a-location) does
*not* always return an absolute path, instead this
depends on how the file path has been passed to LilyPond.
As this commit changed the behaviour of point-and-click
in a somewhat unintentional and unmaintainable way it
is better to revert the commit. Especially as the
original behaviour was not harmful.
========================
The check for absolute paths in in output-ps.scm
and -svg.scm is unnecessary because
(car ly:input-file-line-char-column a-location)
always returns an absolute, slashified path
Now is-absolute? is not used anymore by LilyPond itself. (reverted from commit f30a8189adbbeefa2103e2c2e194040f66bc2291)
---
scm/output-ps.scm | 6 +++++-
scm/output-svg.scm | 12 ++++++++----
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/scm/output-ps.scm b/scm/output-ps.scm
index 69f2772039..70b13848e4 100644
--- a/scm/output-ps.scm
+++ b/scm/output-ps.scm
@@ -157,6 +157,10 @@
(ly:in-event-class? cause t))
point-and-click))))
(let* ((location (ly:input-file-line-char-column music-origin))
+ (raw-file (car location))
+ (file (if (is-absolute? raw-file)
+ raw-file
+ (string-append (ly-getcwd) "/" raw-file)))
(x-ext (ly:grob-extent grob grob X))
(y-ext (ly:grob-extent grob grob Y)))
@@ -171,7 +175,7 @@
;; Backslashes are not valid
;; file URI path separators.
(ly:string-percent-encode
- (ly:string-substitute "\\" "/" (car location)))
+ (ly:string-substitute "\\" "/" file))
(cadr location)
(caddr location)
diff --git a/scm/output-svg.scm b/scm/output-svg.scm
index ca086318d7..78bda3c35b 100644
--- a/scm/output-svg.scm
+++ b/scm/output-svg.scm
@@ -485,14 +485,18 @@
(else (any (lambda (t)
(ly:in-event-class? cause t))
point-and-click)))
- (let* ((location (ly:input-file-line-char-column music-origin)))
-
+ (let* ((location (ly:input-file-line-char-column music-origin))
+ (raw-file (car location))
+ (file (if (is-absolute? raw-file)
+ raw-file
+ (string-append (ly-getcwd) "/" raw-file))))
+
(ly:format "\n"
;; Backslashes are not valid
;; file URI path separators.
(ly:string-percent-encode
- (ly:string-substitute "\\" "/" (car location)))
-
+ (ly:string-substitute "\\" "/" file))
+
(cadr location)
(caddr location)
(1+ (cadddr location))))))))
--
2.39.2