From 8cbbc71775aa98fd45ea266b576f0c58c703da0f Mon Sep 17 00:00:00 2001 From: Patrick McCarty Date: Fri, 16 Apr 2010 19:04:12 -0700 Subject: [PATCH] Rewrite `ly-getcwd' for Guile 1.8 backward compat. Guile 1.9 (and future Guile 2.0) adheres more strictly to R5RS and R6RS in that (if ...) and (case ...) clauses cannot contain top-level bindings created with (define ...). This commit fixes the compatibility issue, and as an additional benefit, simplifies the procedure `ly-getcwd'. --- scm/lily.scm | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/scm/lily.scm b/scm/lily.scm index c680b0ff0a..8cfebbd0db 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -272,25 +272,17 @@ messages into errors.") (if (null? (cdr platform)) #f (member (string-downcase (cadr platform)) '("95" "98" "me"))))) -(case PLATFORM - ((windows) - (define native-getcwd - getcwd) - - (define (slashify x) - (if (string-index x #\\) - x - (string-regexp-substitute - "//*" "/" - (string-regexp-substitute "\\\\" "/" x)))) - - ;; FIXME: this prints a warning. - (define-public (ly-getcwd) - (slashify (native-getcwd)))) - - (else - (define-public ly-getcwd - getcwd))) +(define (slashify x) + (if (string-index x #\\) + x + (string-regexp-substitute + "//*" "/" + (string-regexp-substitute "\\\\" "/" x)))) + +(define-public (ly-getcwd) + (if (eq? PLATFORM 'windows) + (slashify (getcwd)) + (getcwd))) (define-public (is-absolute? file-name) (let ((file-name-length (string-length file-name))) -- 2.39.5