diff --git a/platformio/app.py b/platformio/app.py index c2b95967..74d4c9cb 100644 --- a/platformio/app.py +++ b/platformio/app.py @@ -157,6 +157,9 @@ class State(object): self.modified = True return self._storage.update(*args, **kwargs) + def clear(self): + return self._storage.clear() + def __getitem__(self, key): return self._storage[key] diff --git a/platformio/commands/home/rpc/handlers/app.py b/platformio/commands/home/rpc/handlers/app.py index 1666dc17..9e26d2c0 100644 --- a/platformio/commands/home/rpc/handlers/app.py +++ b/platformio/commands/home/rpc/handlers/app.py @@ -25,6 +25,11 @@ class AppRPC(object): APPSTATE_PATH = join(get_project_core_dir(), "homestate.json") + IGNORE_STORAGE_KEYS = [ + "cid", "coreVersion", "coreSystype", "coreCaller", "coreSettings", + "homeDir", "projectsDir" + ] + @staticmethod def load_state(): with app.State(AppRPC.APPSTATE_PATH, lock=True) as state: @@ -66,6 +71,10 @@ class AppRPC(object): @staticmethod def save_state(state): with app.State(AppRPC.APPSTATE_PATH, lock=True) as s: - # s.clear() + s.clear() s.update(state) + storage = s.get("storage", {}) + for k in AppRPC.IGNORE_STORAGE_KEYS: + if k in storage: + del storage[k] return True