kicad-developers team mailing list archive
Mailing list archive
Re: [PATCH] Prevent Eeschema from opening the same file twice
Le 03/01/2013 18:38, Jacobo Aragunde Pérez a écrit :
Currently KiCad applications allow opening the same file more than once,
and they don't check if the files have changed in disk before saving. As
a consequence, there can be situations where the user loses some data
This patch uses wxSingleInstanceChecker to create a lock on the open
file. It is checked every time Eeschema tries to open a file. We can
distinguish two situations:
* Open a file when the application is started. In this case, if the lock
is unsuccessful the application closes, it doesn't even show the alert
about other instances running.
* Open another file from the menu (file -> open or tool bar). In this
case, if the lock is unsuccessful the application remains open with its
Finally, this patch is a starting point to implement similar checks in
other KiCad applications.
I committed your patch, with a small change for Windows, about file
separator which is not the same as Unix.
Generally speaking, due to the multi-platform aspect of Kicad, a
particular care for filenames should be considered.
Note, for this reason, in Kicad files, filenames are always stored in
Unix notation (if this is not the case, this is a bug).
Sometimes filenames should be converted in Windows notation:
usually a name like mydir/myfile does not create problems when used
However, as far as remember, this is not true when a file comes from a
//myserver/mydir/myfile should be converted to \\myserver\mydir\myfile