bin/droid script: fix wierd mkdir error on my device

Here's the error:
    adb: error: failed to copy '...' to '...':
    remote secure_mkdirs failed: Operation not permitted

I also cleaned up the script.

No-Try: true
Change-Id: Ie2dec7b42eaf2a19475cdd0a04074f8bec47b2fb
Reviewed-on: https://skia-review.googlesource.com/148906
Auto-Submit: Hal Canary <halcanary@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
diff --git a/bin/droid b/bin/droid
index cb48e36..53deb5b 100755
--- a/bin/droid
+++ b/bin/droid
@@ -8,15 +8,23 @@
 #
 # See https://skia.org/user/quick/gn for build instructions.
 
-path=$1
-name=$(basename $1)
+dst_dir=/data/local/tmp
+path="$1"
+name="$(basename "$path")"
 shift
-args=$@
+
+if ! [ -d resources ]; then
+    echo run this from the skia tree
+    exit 1
+fi
+
+dirs=''
+for dir in $(find resources -type d); do dirs="$dirs \"${dir}\""; done
 
 set -e
 set -x
 
-adb push --sync $path //data/local/tmp/
-adb push --sync resources //data/local/tmp/
-adb shell "chmod +x //data/local/tmp/$name"
-adb shell "cd //data/local/tmp; ./$name $args"
+adb shell "cd \"$dst_dir\"; mkdir -p $dirs"
+adb push --sync resources "${dst_dir}/"
+adb push --sync "$path" "${dst_dir}/${name}"
+adb shell "cd \"$dst_dir\"; chmod +x \"$name\"; \"./$name\" $*"