lilypond-devel
[Top][All Lists]
Advanced

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

Re: Add backup option to convert-ly (Issue 3572) (issue 14040043)


From: David Kastrup
Subject: Re: Add backup option to convert-ly (Issue 3572) (issue 14040043)
Date: Fri, 04 Oct 2013 18:32:38 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Eluze <address@hidden> writes:

> Phil Holmes wrote
>>>
>>> And while we are at it: the loop has the condition
>>>  while os.path.exists(back_up) and os.path.isfile(back_up):
>>> for skipping over existing files.  The second part of the condition is
>>> nonsensical since it means that a name will be used for backing up even
>>> if it is already taken by a directory or fifo or socket.
>>>
>>> https://codereview.appspot.com/14040043/
>> 
>> I presume Eluze put it in for a specific reason which I don't know. 
>> Eluze?
>
> well - as you certainly guess, the code isn't purely mine and I was already
> wondering why there are these two conditions.
>
> now reading a little bit more I found that "A path is an unambiguous pointer
> to a resource in the file system. It can either point to a file or to a
> directory."
>
> this seems exactly what we don't want, we don't deal with directories here -
> so it's sufficient to test if it is an existing /file/:
> *os.path.isfile(back_up)* should be used solely.

Wrong.  os.path.exists (back_up) should be used solely since we are
looking for an _unused_ file name.  If there is a directory called
file.ly.~1~ we have to skip this just as much in our search as if there
is a file called file.ly.~1~ as we don't want to overwrite either
existing files or existing directories.

-- 
David Kastrup



reply via email to

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