From 56b9b878f812eaca59e0677f4ac499e534a8e1f2 Mon Sep 17 00:00:00 2001 From: Philipp Crocoll Date: Sat, 2 Jun 2018 06:55:48 +0200 Subject: [PATCH] make sure the local backup is not used automatically instead of the actual file --- src/Kp2aBusinessLogic/database/edit/LoadDB.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Kp2aBusinessLogic/database/edit/LoadDB.cs b/src/Kp2aBusinessLogic/database/edit/LoadDB.cs index 2dd2c009..22e8a32b 100644 --- a/src/Kp2aBusinessLogic/database/edit/LoadDB.cs +++ b/src/Kp2aBusinessLogic/database/edit/LoadDB.cs @@ -18,6 +18,7 @@ This file is part of Keepass2Android, Copyright 2013 Philipp Crocoll. This file using System; using System.IO; using System.Linq; +using System.Threading; using System.Threading.Tasks; using KeePassLib; using KeePassLib.Keys; @@ -53,6 +54,7 @@ namespace keepass2android { try { + //make sure the file data is stored in the recent files list even if loading fails SaveFileData(_ioc, _keyfileOrProvider); @@ -137,7 +139,12 @@ namespace keepass2android { _app.LoadDatabase(_ioc, workingCopy, _compositeKey, StatusLogger, _format); Kp2aLog.Log("LoadDB OK"); - Finish(true, _format.SuccessMessage); + + //make sure the stored access time for the actual file is more recent than that of its backup + Thread.Sleep(10); + SaveFileData(_ioc, _keyfileOrProvider); + + Finish(true, _format.SuccessMessage); } catch (OldFormatException) {