Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
diff options
authorSimon Schampijer <simon@schampijer.de>2010-08-09 01:01:50 (GMT)
committer James Cameron <quozl@laptop.org>2010-08-09 01:11:37 (GMT)
commita8d13c9f2b99c2de571f3792e821cd119c0f82c5 (patch)
parentddcadf49240febbea1da422b66b9770f4bf9d963 (diff)
fix failure to start Read on newly installed system, dev.laptop.org #10218
Read from USB stick using object chooser fails, only on the first attempt on a newly installed system. The error we are seeing is that the '(env.get_profile_path(), 'data'))' does not exist yet at that time. It gets created when an activity like Browse or Terminal has been run for the first time or you start Read by resuming the file on the external device. The issue is not read specific, same is true for Memorize when you use the object chooser in the create tab and try to open an image from the external device. Tested on os850 on XO-1.5. Reviewed-by: James Cameron <quozl@laptop.org> Reviewed-by: Daniel Drake <dsd@laptop.org> Tested-by: James Cameron <quozl@laptop.org>
1 files changed, 5 insertions, 3 deletions
diff --git a/src/sugar/datastore/datastore.py b/src/sugar/datastore/datastore.py
index 637c083..c3ca17d 100644
--- a/src/sugar/datastore/datastore.py
+++ b/src/sugar/datastore/datastore.py
@@ -214,9 +214,11 @@ class RawObject(object):
# to create hardlinks to jobject files
# and w/o this, it wouldn't work since we have file from mounted device
if self._file_path is None:
- self._file_path = tempfile.mktemp(
- prefix='rawobject',
- dir=os.path.join(env.get_profile_path(), 'data'))
+ data_path = os.path.join(env.get_profile_path(), 'data')
+ self._file_path = tempfile.mktemp(prefix='rawobject',
+ dir=data_path)
+ if not os.path.exists(data_path):
+ os.makedirs(data_path)
os.symlink(self.object_id, self._file_path)
return self._file_path