From 154a0e91ffece83fd1e7ef836c6faaa83166e93c Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Sun, 18 Mar 2007 12:48:34 +0000 Subject: Create ~/Activities only when necessary --- (limited to 'sugar') diff --git a/sugar/activity/bundlebuilder.py b/sugar/activity/bundlebuilder.py index 120e7b8..be1d200 100644 --- a/sugar/activity/bundlebuilder.py +++ b/sugar/activity/bundlebuilder.py @@ -92,9 +92,6 @@ def _get_bundle_dir(): def _get_install_dir(prefix): return os.path.join(prefix, 'share/activities') -def _get_bundle_path(): - return os.path.join(env.get_user_activities_path(), _get_bundle_dir()) - def _get_package_name(): bundle = Bundle(_get_source_path()) zipname = '%s-%d.xo' % (bundle.get_name(), bundle.get_activity_version()) @@ -120,7 +117,10 @@ setup.py help - print this message \n\ ' def cmd_dev(): - bundle_path = os.path.join(env.get_user_activities_path(), _get_bundle_dir()) + bundle_path = env.get_user_activities_path() + if not os.path.isdir(bundle_path): + os.mkdir(bundle_path) + bundle_path = os.path.join(bundle_path, _get_bundle_dir()) try: os.symlink(_get_source_path(), bundle_path) except OSError: diff --git a/sugar/env.py b/sugar/env.py index 4938940..2acdcb9 100644 --- a/sugar/env.py +++ b/sugar/env.py @@ -53,10 +53,7 @@ def get_profile_path(path=None): return base def get_user_activities_path(): - path = os.path.expanduser('~/Activities') - if not os.path.isdir(path): - os.mkdir(path) - return path + return os.path.expanduser('~/Activities') def get_bin_path(path=None): return _get_prefix_path('bin', path) -- cgit v0.9.1