mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 01:57:13 +02:00
Do not save unnecessary data for PIO Home
This commit is contained in:
@ -157,6 +157,9 @@ class State(object):
|
|||||||
self.modified = True
|
self.modified = True
|
||||||
return self._storage.update(*args, **kwargs)
|
return self._storage.update(*args, **kwargs)
|
||||||
|
|
||||||
|
def clear(self):
|
||||||
|
return self._storage.clear()
|
||||||
|
|
||||||
def __getitem__(self, key):
|
def __getitem__(self, key):
|
||||||
return self._storage[key]
|
return self._storage[key]
|
||||||
|
|
||||||
|
@ -25,6 +25,11 @@ class AppRPC(object):
|
|||||||
|
|
||||||
APPSTATE_PATH = join(get_project_core_dir(), "homestate.json")
|
APPSTATE_PATH = join(get_project_core_dir(), "homestate.json")
|
||||||
|
|
||||||
|
IGNORE_STORAGE_KEYS = [
|
||||||
|
"cid", "coreVersion", "coreSystype", "coreCaller", "coreSettings",
|
||||||
|
"homeDir", "projectsDir"
|
||||||
|
]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def load_state():
|
def load_state():
|
||||||
with app.State(AppRPC.APPSTATE_PATH, lock=True) as state:
|
with app.State(AppRPC.APPSTATE_PATH, lock=True) as state:
|
||||||
@ -66,6 +71,10 @@ class AppRPC(object):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def save_state(state):
|
def save_state(state):
|
||||||
with app.State(AppRPC.APPSTATE_PATH, lock=True) as s:
|
with app.State(AppRPC.APPSTATE_PATH, lock=True) as s:
|
||||||
# s.clear()
|
s.clear()
|
||||||
s.update(state)
|
s.update(state)
|
||||||
|
storage = s.get("storage", {})
|
||||||
|
for k in AppRPC.IGNORE_STORAGE_KEYS:
|
||||||
|
if k in storage:
|
||||||
|
del storage[k]
|
||||||
return True
|
return True
|
||||||
|
Reference in New Issue
Block a user