Filter duplicated recent projects on Windows

This commit is contained in:
Ivan Kravets
2021-11-05 17:05:30 +02:00
parent a24ec8b07a
commit f88a2de8a9
2 changed files with 10 additions and 3 deletions

View File

@ -64,9 +64,13 @@ class AppRPC:
storage["projectsDir"] = storage["coreSettings"]["projects_dir"]["value"]
# skip non-existing recent projects
storage["recentProjects"] = [
p for p in storage.get("recentProjects", []) if is_platformio_project(p)
]
storage["recentProjects"] = list(
set(
os.path.normpath(p)
for p in storage.get("recentProjects", [])
if is_platformio_project(p)
)
)
state["storage"] = storage
state.modified = False # skip saving extra fields

View File

@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import time
from ajsonrpc.core import JSONRPC20DispatchException
@ -51,6 +52,8 @@ class IDERPC:
def on_command_result(self, cmd_id, value):
if cmd_id not in self._cmd_queue:
return
if self._cmd_queue[cmd_id]["method"] == "get_pio_project_dirs":
value = [os.path.normpath(p) for p in value]
self._cmd_queue[cmd_id]["future"].set_result(value)
del self._cmd_queue[cmd_id]