termux-api: Handle path whitespace in termux-api

This closes #120.
This commit is contained in:
Fredrik Fornwall 2016-01-04 17:16:55 -05:00
parent 005da1ca38
commit fa5ce6c493
2 changed files with 7 additions and 3 deletions

View File

@ -1,6 +1,6 @@
TERMUX_PKG_HOMEPAGE=http://termux.com/add-ons/api/
TERMUX_PKG_DESCRIPTION="Termux API commands"
TERMUX_PKG_VERSION=0.10
TERMUX_PKG_VERSION=0.11
termux_step_make_install () {
mkdir -p $TERMUX_PREFIX/bin

View File

@ -43,6 +43,10 @@ esac
done
if [ $# -gt 1 ]; then echo "Only one file can be shared"; exit 1; fi
if [ $# != 0 ]; then PARAMS="$PARAMS --es file `realpath $1`"; fi
@TERMUX_API@ Share $PARAMS
if [ $# != 0 ]; then
# Note that the file path can contain whitespace.
@TERMUX_API@ Share $PARAMS --es file "`realpath "$1"`"
else
@TERMUX_API@ Share $PARAMS
fi