Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu@tomeuvizoso.net>2007-08-13 19:14:25 (GMT)
committer Tomeu Vizoso <tomeu@tomeuvizoso.net>2007-08-13 19:14:25 (GMT)
commit4c812eb210b266f8d458b247051135ac967d046f (patch)
treebfdbc2f983657dc9b5e90d86abfe857767c1af45 /sugar
parentb7e509b21b1adc073eda27052fc072516669fe66 (diff)
Set ACTIVITY_ROOT environment variable.
Diffstat (limited to 'sugar')
-rw-r--r--sugar/activity/activity.py12
-rw-r--r--sugar/activity/activityfactoryservice.py2
2 files changed, 14 insertions, 0 deletions
diff --git a/sugar/activity/activity.py b/sugar/activity/activity.py
index 2c887b9..262d89b 100644
--- a/sugar/activity/activity.py
+++ b/sugar/activity/activity.py
@@ -305,6 +305,18 @@ class Activity(Window, gtk.Container):
def _internal_jobject_error_cb(self, err):
logging.debug("Error creating activity datastore object: %s" % err)
+ def get_activity_root(self):
+ """
+ Return the appropriate location in the fs where to store activity related
+ data that doesn't pertain to the current execution of the activity and
+ thus cannot go into the DataStore.
+ """
+ if os.environ.has_key('SUGAR_ACTIVITY_ROOT') and \
+ os.environ['SUGAR_ACTIVITY_ROOT']:
+ return os.environ['SUGAR_ACTIVITY_ROOT']
+ else:
+ return '/'
+
def read_file(self, file_path):
"""
Subclasses implement this method if they support resuming objects from
diff --git a/sugar/activity/activityfactoryservice.py b/sugar/activity/activityfactoryservice.py
index 8b1397f..63265a1 100644
--- a/sugar/activity/activityfactoryservice.py
+++ b/sugar/activity/activityfactoryservice.py
@@ -30,6 +30,7 @@ from sugar.activity.bundle import Bundle
from sugar.activity import activityhandle
from sugar import logger
from sugar import _sugarext
+from sugar import env
# Work around for dbus mutex locking issue
gobject.threads_init()
@@ -156,6 +157,7 @@ def run(bundle_path):
gtk.icon_theme_get_default().append_search_path(bundle.get_icons_path())
os.environ['SUGAR_BUNDLE_PATH'] = bundle_path
+ os.environ['SUGAR_ACTIVITY_ROOT'] = env.get_profile_path(bundle.get_service_name())
_sugarext.set_prgname(bundle.get_service_name())
_sugarext.set_application_name(bundle.get_name())