From ebcfbcedc2521c89bf60f0200ef02d70da82861a Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Thu, 13 Dec 2007 13:13:33 +0100 Subject: [PATCH] In case of error when mounting the DS, move the existing data and start a clean one. (neuralis) --- shell/view/Shell.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/shell/view/Shell.py b/shell/view/Shell.py index b9d259f0..72aa3b1c 100644 --- a/shell/view/Shell.py +++ b/shell/view/Shell.py @@ -20,6 +20,7 @@ import logging import tempfile import os import time +import shutil import gobject import gtk @@ -80,8 +81,16 @@ class Shell(gobject.GObject): def _start_journal_idle(self): # Mount the datastore in internal flash - datastore.mount(env.get_profile_path('datastore'), [], - timeout=120 * DBUS_PYTHON_TIMEOUT_UNITS_PER_SECOND) + ds_path = env.get_profile_path('datastore') + try: + datastore.mount(ds_path, [], timeout=120 * \ + DBUS_PYTHON_TIMEOUT_UNITS_PER_SECOND) + except: + # Don't explode if there's corruption; move the data out of the way + # and attempt to create a store from scratch. + shutil.move(ds_path, os.path.abspath(ds_path) + str(time.time())) + datastore.mount(ds_path, [], timeout=120 * \ + DBUS_PYTHON_TIMEOUT_UNITS_PER_SECOND) # Checking for the bundle existence will also ensure # that the shell service is started up.