lilypond-user
[Top][All Lists]
Advanced

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

Re: Include path syntax on Mac


From: David Wright
Subject: Re: Include path syntax on Mac
Date: Tue, 14 Aug 2018 23:26:01 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed 15 Aug 2018 at 00:58:51 (+0200), Urs Liska wrote:
> Am 14.08.2018 um 22:21 schrieb David Wright:
> >On Tue 14 Aug 2018 at 21:31:18 (+0200), Urs Liska wrote:
> >>Hi all,
> >>
> >>it seems LilyPond on Windows requires paths passed to the -I command
> >>line option to have a trailing slash while LilyPond on Linux doesn't
> >>seem to care whether there is or not (see
> >>https://github.com/wbsoft/frescobaldi/issues/1094). It seems a fix
> >>to the issue in Frescobaldi is to ensure there's a trailing slash to
> >>the paths, which makes it work on Windows and Linux.
> >>
> >>Before merging this code I'd need to know whether Mac also doesn't
> >>care about the trailing slash. Obviously it accepts paths without
> >>slashes, but if it should not accept them *with* slashes I'd need to
> >>make the changed code aware of the OS.
> >>
> >>Could someone please test (or tell me directly) whether it makes a
> >>difference if a path passed to -I has a trailing slash or not on
> >>Mac?
> >It's worth bearing in mind that AFAICT -I can take a relative path.
> 
> Yes, it can.
> Although it's not really relevant for my use case as Frescobaldi (at
> least when used as intended) uses absolute paths.
> 
> >In windows, D: and D:\ can be different directories depending on
> >circumstances. No idea about the Mac, though.
> >
> >Is LP constructing filenames merely by concatenating part1, delimiter
> >and part2? This usually works but isn't the Right Way, hence functions
> >like Python's os.path.join().
> 
> I don't know what *LilyPond* does, but in Frescobaldi the path that
> is stored by default is the result of a PyQt dialog's choice, so we
> *can* expect it to be correct with regard to the actual OS. It's
> just that this doesn't add a trailing slash to the path, and
> LilyPond seems to choke on that on Windows.

Then LP needs fixing. Sorry, but insisting that users specify
directory names with a trailing (back)slash is plain wrong.¹
And, as shown above, mindlessly appending one is worse, as it
can change the meaning of what the user wrote.

Also, if someone writes   -I D:foo   and you want to convert it
to an absolute path, it's necessary to find out what the current
directory is on drive D: which may have no relationship to the
current directory on the current drive (ie if D: is not the
current drive).

> (you can write *anything* in the line edit in Frescobaldi, so you
> can also make it break, but I don't think we have to deal with wrong
> input here.)

AFAIK the rules for writing valid filenames and directory names
in windows are well-defined and identical, ie the only way to
distinguish a file from a directory by its name is to ask the OS.

¹Note that I'm not saying a user *can't* specify a trailing
(back)slash on a directory name; the program can merely strip it
(as long as it's not syntactically a root directory).

Cheers,
David.



reply via email to

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