From e82c31dd1cd02ecc3d2b8b56228d4a07e28bf9ed Mon Sep 17 00:00:00 2001
From: Benoit Rospars <benoit.rospars@inria.fr>
Date: Thu, 4 May 2023 14:55:16 +0200
Subject: [PATCH] Issue #94 : update recent files when new is saved and filter
 out if not exists

---
 electron/components/file.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/electron/components/file.js b/electron/components/file.js
index 773a8c45..806194f7 100644
--- a/electron/components/file.js
+++ b/electron/components/file.js
@@ -8,7 +8,9 @@ const { wait } = require('./utils');
 const Store = require('electron-store');
 const store = new Store();
 
-const recentFiles = store.get('recentFiles', []);
+const recentFiles = store.get('recentFiles', []).filter((r) => {
+    return fs.existsSync(r.filepath);
+});
 
 /**
  * Get the list of recently opened ePoc projects
@@ -152,6 +154,8 @@ const saveAsEpocProject = async function (project) {
 
     if(!files) return null;
 
+    updateRecent(project);
+
     return zipEpocProject(project.workdir, files);
 };
 
-- 
GitLab