Permalink
Browse files

fix if the file does not have extension

  • Loading branch information...
taylorchu committed Apr 12, 2012
1 parent f5a873d commit a4e94cb516ad1313dba9f630cbd120256c0ace0f
Showing with 6 additions and 2 deletions.
  1. +6 −2 xdg-open
View
@@ -42,8 +42,12 @@ if [[ "$arg" =~ ^([a-zA-Z]+): ]]; then
program=$(find_program "$protocol")
elif [[ -f "$arg" ]]; then
# handle file
- filename="$@"
- ext="${filename##*.}"
+ if [[ "$arg" == *.* ]]; then
+ # have file extension
+ ext="${arg##*.}"
+ else
+ ext=""
+ fi
program=$(find_program "$ext")
elif [[ -d "$arg" ]]; then
# handle directory

0 comments on commit a4e94cb

Please sign in to comment.