Check type of bundle path by os.path.isdir().

This commit is contained in:
Tomeu Vizoso 2007-06-15 16:48:53 +02:00
parent cb9dd212e9
commit 6c0885b490

View File

@ -80,8 +80,7 @@ class Bundle:
def _get_info_file(self): def _get_info_file(self):
info_file = None info_file = None
ext = os.path.splitext(self._path)[1] if os.path.isdir(self._path):
if ext == '.activity':
info_path = os.path.join(self._path, 'activity', 'activity.info') info_path = os.path.join(self._path, 'activity', 'activity.info')
if os.path.isfile(info_path): if os.path.isfile(info_path):
info_file = open(info_path) info_file = open(info_path)
@ -158,8 +157,7 @@ class Bundle:
linfo_file = None linfo_file = None
lang = locale.getdefaultlocale()[0] lang = locale.getdefaultlocale()[0]
ext = os.path.splitext(self._path)[1] if os.path.isdir(self._path):
if ext == '.activity':
linfo_path = os.path.join(self.get_locale_path(), lang, 'activity.linfo') linfo_path = os.path.join(self.get_locale_path(), lang, 'activity.linfo')
if not os.path.isfile(linfo_path): if not os.path.isfile(linfo_path):
linfo_path = os.path.join(self.get_locale_path(), lang[:2], 'activity.linfo') linfo_path = os.path.join(self.get_locale_path(), lang[:2], 'activity.linfo')
@ -205,8 +203,7 @@ class Bundle:
def get_icon(self): def get_icon(self):
"""Get the activity icon name""" """Get the activity icon name"""
ext = os.path.splitext(self._path)[1] if os.path.isdir(self._path):
if ext == '.activity':
activity_path = os.path.join(self._path, 'activity') activity_path = os.path.join(self._path, 'activity')
return os.path.join(activity_path, self._icon + '.svg') return os.path.join(activity_path, self._icon + '.svg')
else: else: