From 141d04694d9dd0a806049d38a3328cceefd87249 Mon Sep 17 00:00:00 2001 From: Gonzalo Odiard Date: Wed, 05 Mar 2014 17:57:33 +0000 Subject: Copy file in read_file method I need copy the file to the instance directory, the path provided by the datastore dissapear later in the life of the activity. Signed-off-by: Gonzalo Odiard --- diff --git a/readactivity.py b/readactivity.py index bf5cc6a..76182ed 100644 --- a/readactivity.py +++ b/readactivity.py @@ -734,7 +734,13 @@ class ReadActivity(activity.Activity): # enable collaboration self.activity_button.page.share.props.sensitive = True - self._load_document('file://' + file_path) + # we need copy the file to a new place, the file_path disappear + extension = os.path.splitext(file_path)[1] + tempfile = os.path.join(self.get_activity_root(), 'instance', + 'tmp%i%s' % (time.time(), extension)) + os.link(file_path, tempfile) + + self._load_document('file://' + tempfile) # FIXME: This should obviously be fixed properly GObject.timeout_add_seconds( -- cgit v0.9.1