getsdcardpath, getscreenshotpath, getlastscreenshot
Added a few new functions to envsetup.sh:
- getsdcardpath() returns the sdcard path. This will be more useful
when multiuser storage complicates the sdcard path.
- getscreenshotpath() returns the path to screenshots
- getlastscreenshot() adb pulls the most recently-taken screenshot
Change-Id: I851145088344dff6f1672f0a423201f3aa3e4390
diff --git a/envsetup.sh b/envsetup.sh
index 701c0f6..4b60c05 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -979,6 +979,28 @@
done
}
+function getsdcardpath()
+{
+ adb ${adbOptions} shell echo -n \$\{EXTERNAL_STORAGE\}
+}
+
+function getscreenshotpath()
+{
+ echo "$(getsdcardpath)/Pictures/Screenshots"
+}
+
+function getlastscreenshot()
+{
+ local screenshot_path=$(getscreenshotpath)
+ local screenshot=`adb ${adbOptions} ls ${screenshot_path} | grep Screenshot_[0-9-]*.*\.png | sort -rk 3 | cut -d " " -f 4 | head -n 1`
+ if [ "$screenshot" = "" ]; then
+ echo "No screenshots found."
+ return
+ fi
+ echo "${screenshot}"
+ adb ${adbOptions} pull ${screenshot_path}/${screenshot}
+}
+
function startviewserver()
{
local port=4939