[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fix a few lilypond-book bugs on windows (Issue 1815). (issue 5183042

From: julien . rioux
Subject: Re: Fix a few lilypond-book bugs on windows (Issue 1815). (issue 5183042)
Date: Tue, 04 Oct 2011 20:22:28 +0000

Reviewers: Reinhold,

Of course you know the code better, so please investigate. I did not
understand why we keep two points to the same file, but if it is needed,
support for windows will require copying the files. There are no hard
links that I am aware of.
File python/ (right):
python/ os.rename (src, dst)
On 2011/10/04 20:10:43, Reinhold wrote:
Doesn't this REMOVE the src? creates a link at dst, so the files at src and dst are
actually the same
file (i.e. both point to the same sectors on the hard drive, and thus
they are
always identical, even if you change one).
Yes it removes the src and moves it to dst. Why do you need the two
points? When I specify the output directory I expect the files to be
moved there.
File python/ (right):
python/ return x
On 2011/10/04 20:10:43, Reinhold wrote:
Ah, so in windows you can give a command line argument argument of the
   my-cmd  \$"`
and the command will actually receive a string containing
And none of these characters (dollar, double quotes, backtick,
backslash) need
to be escaped with a backslash? i.e. you don't need
   my-cmd "\\\$\"\`"

The " might give trouble, but it cannot appear in a filename. Same goes
for \, which is the path separator. It's definitely wrong to use \ as
the escape character anyway. The other characters are plain characters.

Fix a few lilypond-book bugs on windows (Issue 1815).

  - Replace (purely unix) by os.rename.

  - Windows command-line arguments don't need escaping.

  - Use forward slashes within lilypond files.

Please review this at

Affected files:
  M python/
  M python/
  M scripts/

Index: python/
diff --git a/python/ b/python/
index ab7c66e47a60d1a98866e6626aa9564000264458..d47f5ecd48f7a2f37d8566d0ba71f8b76e530f19 100644
--- a/python/
+++ b/python/
@@ -639,7 +639,11 @@ printing diff against existing file." % filename)
             dst_path = os.path.split(dst)[0]
             if not os.path.isdir (dst_path):
                 os.makedirs (dst_path)
-   (src, dst)
+            try:
+                os.rename (src, dst)
+            except OSError:
+                print '\nCould not overwrite file', dst
+                raise CompileError(self.basename())

     def additional_files_to_consider (self, base, full):
         return []
Index: python/
diff --git a/python/ b/python/
index e893aaa3a54482599374629d71ee514bd4eddfd5..7a36a8aaace6ab8cce1b09d8044dc61ced22b38a 100644
--- a/python/
+++ b/python/
@@ -150,6 +150,8 @@ please read 'Setup for MacOS X' in Application Usage.")
 # Modified version of the commands.mkarg(x), which always uses
 # double quotes (since Windows can't handle the single quotes:
 def mkarg(x):
+    if == 'nt':
+        return x
     s = ' "'
     for c in x:
         if c in '\\$"`':
Index: scripts/
diff --git a/scripts/ b/scripts/
index 4d2b000fbd80252d9a3776244f6ad7a26aebdf5f..69156d715e7f4c100f64dd628354a2bbb19adb49 100644
--- a/scripts/
+++ b/scripts/
@@ -422,7 +422,7 @@ def write_file_map (lys, name):
 #(define output-empty-score-list #f)
 #(ly:add-file-name-alist '(%s
-""" % '\n'.join(['("" . "%s")\n' % (ly.basename (), name)
+""" % '\n'.join(['("" . "%s")\n' % (ly.basename ().replace('\\','/'), name)
                  for ly in lys]))

 def split_output_files(directory):

reply via email to

[Prev in Thread] Current Thread [Next in Thread]