(let* ((base (basename (car files) ".ly"))
(log-name (string-append base ".log"))
(log-file (open-file log-name "w")))
- (display "# -*-compilation-*-" log-file)
- (newline log-file)
- ;; Ugh, this opens a terminal
- (ly:message (_ "Redirecting output to ~a...") log-name)
+ ;; Ugh, his opens a terminal
+ ;; Do this when invoked using --quiet, --log or something?
+ ;; (ly:message (_ "Redirecting output to ~a...") log-name)
(ly:port-move (fileno (current-error-port)) log-file)
+ (ly:message "# -*-compilation-*-")
(if (null? (lilypond-all files))
(exit 0)
(begin
(exit 1)))))
(define (gui-no-files-handler)
- (let* ((input (string-append
- (string-regexp-substitute
- "share/lilypond/" "share/doc/lilypond-"
- (getenv "LILYPONDPREFIX"))
- "-1/input"))
- (ly (string-append input "/" "Welcome to LilyPond.ly"))
- (cmd (get-editor-command ly 0 0)))
- (system cmd)))
-
-
-;; Mingw
-;; #(Windows XP HOSTNAME build 2600 5.01 Service Pack 1 i686)
-
-;; Cygwin
-;; #(CYGWIN_NT-5.1 Hostname 1.5.12(0.116/4/2) 2004-11-10 08:34 i686)
-
-;; Debian
-;; #(Linux hostname 2.4.27-1-686 #1 Fri Sep 3 06:28:00 UTC 2004 i686)
-
-(case (string->symbol
- (string-downcase
- (car (string-tokenize (vector-ref (uname) 0) char-set:letter))))
- ((linux) #t)
- ;; On mingw, use gui-main
- ((windows) (define lilypond-main gui-main)))
-
-;;(if (ly:get-option 'quiet)
-;; (define lilypond-main gui-main))
+ (let* ((ly (string-append (ly:effective-prefix) "/ly/"))
+ ;; FIXME: soft-code, localize
+ (welcome-ly (string-append ly "Welcome_to_LilyPond.ly"))
+ (cmd (get-editor-command welcome-ly 0 0)))
+ (ly:message (_ "Invoking `~a'...") cmd)
+ (system cmd)
+ (exit 1)))
+
+;; If no TTY and not using safe, assume running from GUI.
+(or (isatty? (current-input-port))
+ (ly:get-option 'safe)
+ (define lilypond-main gui-main))