diff options
author | Ignacio Rodriguez <ignacio@sugarlabs.org> | 2013-12-24 15:49:08 (GMT) |
---|---|---|
committer | Ignacio Rodriguez <ignacio@sugarlabs.org> | 2013-12-24 15:49:08 (GMT) |
commit | af28198fb4aca5f07befe960e72320bc01505e66 (patch) | |
tree | 4ae13e40495f25fd743b84a69b51e7cf9c76102b | |
parent | b7b9e614e0bf1c87fcdaeb782065f2b72cfb501a (diff) |
-rw-r--r-- | sugargame/util.py | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/sugargame/util.py b/sugargame/util.py index 63685c8..0f9d1e1 100644 --- a/sugargame/util.py +++ b/sugargame/util.py @@ -5,34 +5,33 @@ import os import os.path from sugar3.activity.activity import get_bundle_path -NON_SUGAR_ROOT = '~/.sugar/default/olpcgames' - def get_activity_root(): - """Return the activity root for data storage operations - - If the activity is present, returns the activity's root, - otherwise returns NON_SUGAR_ROOT as the directory. + """ + Return the activity root for data storage operations """ import sugargame if sugargame.ACTIVITY: return sugargame.ACTIVITY.get_activity_root() - else: - return os.path.expanduser(NON_SUGAR_ROOT) def data_path(file_name): - """Return the full path to a file in the data sub-directory of the bundle""" + """ + Return the full path to a file in the data sub-directory of the bundle + """ return os.path.join(get_bundle_path(), 'data', file_name) def tmp_path(file_name): - """Return the full path to a file in the temporary directory""" + """ + Return the full path to a file in the temporary directory + """ return os.path.join(get_activity_root(), 'tmp', file_name) def get_traceback(error): - """Get formatted traceback from current exception + """ + Get formatted traceback from current exception error -- Exception instance raised |