strips directory names from js2h js file parameters. this allows
calling js2h from directories other than one the js source resides in
     exit 1
 fi
 
-# Remove the .js file extension and turn all chars to upper case to get the
-# constant name.
-CONSTANT=$(echo "$FILE" | sed 's:.js$::g' | tr a-z A-Z)
+# Remove the path and .js file extension and turn all chars to upper case to
+# get the constant name.
+CONSTANT=$(echo "$FILE" | sed 's:.*/::g' | sed 's:.js$::g' | tr a-z A-Z)
 
 # minify the script
 cat $FILE | \