OSDN Git Service
Fix handling of H2 lock files
We don't necessarily need to abort if an H2 db lock file exists.
H2 manages these lock files on its own, they should never need manual deleting;
see here for details:
http://www.h2database.com/html/advanced.html#file_locking_protocols
If the lock file exists and another process has the DB open,
H2 will automatically detect this and will throw an exception when trying to
open the DB. I've restructured some startup code to detect this and
cleanly abort NeverNote startup before we do anything dangerous like deleting
files from the 'res' dir. The correct resolution is to close or kill the other
NeverNote process, no need to do anything to the lock file.
If the lock file exists but no other process has the DB open, as happens if
NeverNote crashes badly e.g. due to a segfault in QTJambi, then H2 will also
detect this and will allow startup to proceed anyway.