From 0a03ea627b3475d3dcf9ca6be4914c53eb3ac54b Mon Sep 17 00:00:00 2001 From: Stephen Watson Date: Fri, 25 Nov 2005 17:42:16 +0000 Subject: [PATCH] Better detection of the MIME-types/MIME-thumb location when installing type handlers (Stephen Watson). git-svn-id: https://rox.svn.sourceforge.net/svnroot/rox/trunk/ROX-Lib2@4239 66de3db3-b00d-0410-b41b-f4738ad19bea --- Help/Changes | 5 +++++ python/rox/mime_handler.py | 14 ++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Help/Changes b/Help/Changes index afe962e..af3dc7b 100644 --- a/Help/Changes +++ b/Help/Changes @@ -3,6 +3,11 @@ by Thomas Leonard http://rox.sourceforge.net +25-Nov-2005 +~~~~~~~~~~~ +Better detection of the MIME-types/MIME-thumb location when installing +type handlers (Stephen Watson). + 12-Nov-2005 ~~~~~~~~~~~ Added rox.isappdir() function to test the validity of an AppDir (Stephen diff --git a/python/rox/mime_handler.py b/python/rox/mime_handler.py index 9655b4b..24cbb85 100644 --- a/python/rox/mime_handler.py +++ b/python/rox/mime_handler.py @@ -28,9 +28,9 @@ def load_path(site, dir, leaf): return path def save_path(site, dir, leaf, create=1): - parent=basedir.save_config_path(site, dir) + filer=basedir.load_first_config(SITE, 'ROX-Filer') - if os.path.isdir(parent): + if filer and os.path.isdir(filer): path=basedir.save_config_path(site, dir) path=os.path.join(path, leaf) else: @@ -224,10 +224,14 @@ def _run_by_injector(): try: from zeroinstall.injector import basedir for d in basedir.xdg_cache_dirs: - if rox._roxlib_dir.find(d)==0: + if rox.app_dir.find(d)==0: + # Applicaion is in a cache dir + return True + elif rox._roxlib_dir.find(d)==0: # ROX-Lib is in a cache dir, we are probably being run by the # injector return True + except: pass return False @@ -243,7 +247,9 @@ def _install_at(path, app_dir, injint): os.chmod(tmp, 0755) else: os.symlink(app_dir, tmp) - + + if os.access(path, os.F_OK): + os.remove(path) os.rename(tmp, path) def _install_type_handler(types, dir, desc, application=None, overwrite=True, -- 2.11.4.GIT