daily pastebin goal
41%
SHARE
TWEET

filo2

a guest Mar 8th, 2012 16 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. open_generic()
  2. {
  3.     # If it's a path or a file:/// URL, we can open it with run-mailcap
  4.     #if which run-mailcap >/dev/null &&      <------------------------------------FIRST
  5.         if mimeopen -v 2>/dev/null 1>&2 &&  
  6.         (echo "$1" | grep -q '^file:///' ||
  7.             ! echo "$1" | egrep -q '^[a-zA-Z+\.\-]+:'); then
  8.  
  9.         local file
  10.         file="$1"
  11.  
  12.         # Decode URLs
  13.         if echo "$file" | grep -q '^file:///'; then
  14.             file=${file#file://}
  15.             file=$(echo "$file" | perl -pe 's/%(..)/pack("c", hex($1))/eg')
  16.         fi
  17.  
  18.         #run-mailcap --action=view "$file"   <------------------------------------SECOND
  19.         mimeopen -n "$file"
  20.  
  21.         if [ $? -eq 0 ]; then
  22.             exit_success
  23.         else
  24.             exit_failure_operation_failed
  25.         fi
  26.     fi
  27.  
  28.     sensible-browser "$1"
  29.  
  30.     if [ $? -eq 0 ]; then
  31.         exit_success
  32.     else
  33.         exit_failure_operation_failed
  34.     fi
  35. }
RAW Paste Data
Pastebin PRO WINTER Special!
Get 40% OFF Pastebin PRO accounts!
Top