summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lepus.uberspace.de>2015-11-14 03:26:31 +0100
committerhut <hut@lepus.uberspace.de>2015-11-14 03:26:31 +0100
commit88c1fd2f5c6aec91eb4e13dee1c4b1b703b3d886 (patch)
tree4b7533b74e1edb34c1c24b3424b05cad9c2a93df /ranger
parentfb15823e9203d53eb0829a68f39665a2f7881993 (diff)
downloadranger-88c1fd2f5c6aec91eb4e13dee1c4b1b703b3d886.tar.gz
ext.rifle: slight efficiency improvement over last commit
Don't check for all the other possible function values if
function=='ext' was already established.
Diffstat (limited to 'ranger')
-rwxr-xr-xranger/ext/rifle.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/ranger/ext/rifle.py b/ranger/ext/rifle.py
index 3c54cfc2..c43de24f 100755
--- a/ranger/ext/rifle.py
+++ b/ranger/ext/rifle.py
@@ -194,11 +194,12 @@ class Rifle(object):
         function = rule[0]
         argument = rule[1] if len(rule) > 1 else ''
 
-        if function == 'ext' and os.path.isfile(files[0]):
-            partitions = os.path.basename(files[0]).rpartition('.')
-            if not partitions[0]:
-                return False
-            return bool(re.search('^(' + argument + ')$', partitions[2].lower()))
+        if function == 'ext':
+            if os.path.isfile(files[0]):
+                partitions = os.path.basename(files[0]).rpartition('.')
+                if not partitions[0]:
+                    return False
+                return bool(re.search('^(' + argument + ')$', partitions[2].lower()))
         elif function == 'name':
             return bool(re.search(argument, os.path.basename(files[0])))
         elif function == 'match':