Commits

Iñigo Serna committed 65554b4

Don't execute files with execution permissions set if it has known extension

* lfm/actions.py (enter): don't execute files with execution permissions set
if it has known extension. Feature asked by Maurício

Comments (0)

Files changed (3)

+Fri Oct 14 02:41:34 2011  Iñigo Serna  <inigoserna@gmail.com>
+
+	* lfm/actions.py (enter): don't execute files with execution permissions set
+	if it has known extension. Feature asked by Maurício
+
 Thu Sep 22 23:36:23 2011  Iñigo Serna  <inigoserna@gmail.com>
 
 	* lfm/pyview.py (FileView.show_help): fixed a bug: encode help title.
 ============================================================================
-Last update:	Time-stamp: <2011-09-22 23:40:43 inigo>
+Last update:	Time-stamp: <2011-10-14 02:47:32 inigo>
 ============================================================================
 
 
 DONE:
 - refactor Pane code to make easier writing new Pane codes,
   code is cleaner and simpler now
+- don't execute files with execution permissions set if it has known extension
 
 BUGS FIXED:
 - make tree view fullscreen in PANE_MODE_FULL
             tab.enter_dir(os.path.normpath(os.path.join(tab.path, filename)))
         else:
             tab.init(files.get_linkpath(tab.path, filename))
-    elif typ in (files.FTYPE_REG, files.FTYPE_LNK) and vfstype is not None:
+    elif typ in (files.FTYPE_REG, files.FTYPE_LNK, files.FTYPE_EXE) and vfstype is not None:
         vfs.init(tab, filename, vfstype)
     elif typ == files.FTYPE_EXE and allowexec:
-        do_execute_file(tab)
+        exts = []
+        for filetype in app.prefs.filetypes:
+            exts.extend(app.prefs.filetypes[filetype])
+        ext = os.path.splitext(filename)[1]
+        if len(ext)>0 and ext[1:] in exts:
+            do_special_view_file(tab)
+        else:
+            do_execute_file(tab)
     elif typ == files.FTYPE_REG and allowexec:
         do_special_view_file(tab)
     else:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.