]> git.donarmstrong.com Git - lilypond.git/commitdiff
Bugfix: only append DIRSEP if BASE_
authorJan Nieuwenhuizen <janneke@gnu.org>
Thu, 9 Jun 2005 11:52:07 +0000 (11:52 +0000)
committerJan Nieuwenhuizen <janneke@gnu.org>
Thu, 9 Jun 2005 11:52:07 +0000 (11:52 +0000)
or EXT_ components non-empty.

ChangeLog
flower/file-name.cc
lily/lily-parser-scheme.cc
scm/editor.scm
scm/lily.scm
scm/ps-to-png.scm

index f6f55e400d047b767034986e25ebe41f0fa5d0dd..69fdccdb847fa6600140287d89c9c7f556d7c850 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2005-06-09  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+       * flower/file-name.cc: Bugfix: only append DIRSEP if BASE_
+       or EXT_ components non-empty.
+
+2005-06-08  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+       * scm/lily.scm (running-from-gui?): Export.
+
+       * lily/lily-parser-scheme.cc (ly:parse-file): Use it to generate
+       output in .ly source directory.
+
 2005-06-09  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
        * ttftool/util.c (surely_lseek): more verbosity.
index 1763a546c054ca12c0715cdcf60fd3e3dbf31fde..ea36d4802bfbddcd61613ce65cf34f21dfe95dbe 100644 (file)
@@ -68,7 +68,11 @@ File_name::to_string () const
   if (!root_.is_empty ())
     s = root_ + ::to_string (ROOTSEP);
   if (!dir_.is_empty ())
-    s += dir_ + ::to_string (DIRSEP);
+    {
+      s += dir_;
+      if (!base_.is_empty () || !ext_.is_empty ())
+       s += ::to_string (DIRSEP);
+    }
   s += base_;
   if (!ext_.is_empty ())
     s += ::to_string (EXTSEP) + ext_;
index 093c9c3ae65bbd112f58cd529ccb66f8edd205d3..07ad5f7b7dd5a31f58b5d996f0292c2434976b06 100644 (file)
@@ -55,8 +55,19 @@ LY_DEFINE (ly_parse_file, "ly:parse-file",
   out_file_name.root_ = "";
   out_file_name.dir_ = "";
 
+  /* When running from gui, generate output in .ly source directory.  */
+  if (output_name_global.is_empty ()
+      && scm_call_0 (ly_lily_module_constant ("running-from-gui?")) == SCM_BOOL_T)
+    {
+      File_name f (file);
+      f.base_ = "";
+      f.ext_ = "";
+      output_name_global = f.to_string ();
+    }
+
   if (!output_name_global.is_empty ())
     {
+      /* Interpret --output=DIR to mean --output=DIR/BASE.  */
       if (is_dir (output_name_global))
        {
          char cwd[PATH_MAX];
index 82923aa7b46a0cd2ede715dc1fe006bb988afd35..af62e7c3b314a153a5e6dc70041254841812a9b4 100644 (file)
@@ -9,8 +9,8 @@
 ;; Also for standalone use, so cannot include any lily modules.
 (use-modules
  (ice-9 regex)
 (srfi srfi-13)
 (srfi srfi-14))
+ (srfi srfi-13)
+ (srfi srfi-14))
 
 (define PLATFORM
   (string->symbol
index 339217d3f12a03626377bade1dc87dd6651688da..66bedac6138df7bc678891ccd9875773b0487a2f 100644 (file)
@@ -336,7 +336,7 @@ The syntax is the same as `define*-public'."
 
 (use-modules (scm editor))
 
-(define (running-from-gui?)
+(define-public (running-from-gui?)
   (let ((have-tty? (isatty? (current-input-port))))
     ;; If no TTY and not using safe, assume running from GUI.
     (cond
index d9c406acbc395bbe61f53dd378d2c2994dea8c6e..0908ffe9c8f7f6e690d444d09de8d368b4ca899c 100644 (file)
  (ice-9 optargs)
  (ice-9 regex)
  (ice-9 rw)
- (srfi srfi-1))
+ (srfi srfi-1)
+ (srfi srfi-13)
+ (srfi srfi-14))
 
 ;; gettext wrapper for guile < 1.7.2
 (if (defined? 'gettext)
     (define-public _ gettext)
     (define-public (_ x) x))
 
+(define PLATFORM
+  (string->symbol
+   (string-downcase
+    (car (string-tokenize (vector-ref (uname) 0) char-set:letter)))))
+
 (define (re-sub re sub string)
   (regexp-substitute/global #f re string 'pre sub 'post))
 
                   (begin
                     (format (current-error-port) (_ "Invoking `~a'...") cmd)
                     (newline (current-error-port)))))
+         (baz 
+          ;; The wrapper on windows cannot handle `=' signs,
+          ;; gs has a workaround with #.
+          (if (eq? PLATFORM 'windows)
+              (begin
+                (set! cmd (re-sub "=" "#" cmd))
+                (set! cmd (re-sub "-dSAFER " "" cmd)))))
          (status (system cmd)))
      (if (not (= status 0))
         (begin