Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@gmail.com>2014-03-05 17:57:33 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2014-03-05 18:03:50 (GMT)
commit141d04694d9dd0a806049d38a3328cceefd87249 (patch)
tree04d2a311fbb3c895b33aea29598e60dc3b4007f7
parent03de5af287fa97031d2bfb4563261c1b0c07865d (diff)
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 <godiard@sugarlabs.org>
-rw-r--r--readactivity.py8
1 files changed, 7 insertions, 1 deletions
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(