Skip to content

Commit 18feace

Browse files
authored
Merge pull request #51 from xeffyr/fix-termux-share
termux-share: remove slash from beginning of file path
2 parents 4db6f75 + 9e89316 commit 18feace

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

scripts/termux-share

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,16 @@ shift $(($OPTIND-1))
4242
if [ $# -gt 1 ]; then echo "$SCRIPTNAME: too many arguments"; exit 1; fi
4343

4444
if [ $# != 0 ]; then
45+
FILE="$1"
46+
if [ -f "$FILE" ]; then
47+
FILE=`realpath "$FILE"`
48+
fi
49+
50+
# Fix for issues on Android 8.1.
51+
FILE=$(echo "$FILE" | sed 's/^\///')
52+
4553
# Note that the file path can contain whitespace.
46-
/data/data/com.termux/files/usr/libexec/termux-api Share $PARAMS --es file "`realpath "$1"`"
54+
/data/data/com.termux/files/usr/libexec/termux-api Share $PARAMS --es file "$FILE"
4755
else
4856
/data/data/com.termux/files/usr/libexec/termux-api Share $PARAMS
4957
fi

0 commit comments

Comments
 (0)