]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/lilypond-invoke-editor.scm
* lily/main.cc (setup_paths)[__MINGW32__]: Normalize LILYPONDPREFIX.
[lilypond.git] / scripts / lilypond-invoke-editor.scm
index 56218fb7443862c17fdb844c1d966392a09a5fcc..a9cf32c2497c28543d69acef4879ff10f529fb95 100755 (executable)
  (srfi srfi-14))
 
 (define PROGRAM-NAME "lilypond-invoke-editor")
-(define TOPLEVEL-VERSION "2.5.25")
-(define DATADIR "@DATADIR@")
+(define TOPLEVEL-VERSION "@TOPLEVEL_VERSION@")
+(define DATADIR "@datadir@")
 (define COMPILE-TIME-PREFIX
   (format #f "~a/lilypond/~a" DATADIR TOPLEVEL-VERSION))
-(define LILYPONDPREFIX (or (getenv "LILYPONDPREFIX") COMPILE-TIME-PREFIX))
+
+;; argv0 relocation -- do in wrapper?
+(define LILYPONDPREFIX
+  (or (getenv "LILYPONDPREFIX")
+      (let* ((bindir (dirname (car (command-line))))
+            (prefix (dirname bindir))
+            (lilypond-prefix
+             (if (eq? prefix (dirname DATADIR)) COMPILE-TIME-PREFIX
+                 (format #f "~a/share/lilypond/~a"
+                         prefix TOPLEVEL-VERSION))))
+       lilypond-prefix)))
 
 ;; gettext wrapper for guile < 1.7.2
 (if (defined? 'gettext)
@@ -96,9 +106,7 @@ Options:
 (define (running-from-gui?)
   (let ((have-tty? (isatty? (current-input-port))))
     ;; If no TTY and not using safe, assume running from GUI.
-    ;; for mingw, the test must be inverted.
-    (if (eq? PLATFORM 'windows)
-       have-tty? (not have-tty?))))
+    (not have-tty?)))
 
 (define (main args)
   (let ((files (parse-options args)))