diff options
author | Mike Lockwood <lockwood@android.com> | 2010-02-19 17:53:27 -0500 |
---|---|---|
committer | Mike Lockwood <lockwood@android.com> | 2010-02-19 17:53:27 -0500 |
commit | 0ef3fd048aeaeb59467e43e543f66b96e4e6c7f5 (patch) | |
tree | 1f9a74c6e555959741f958be4036048ce5486870 | |
parent | fa36f2c3b7707865867ce2b4710efeaeef993b1d (diff) | |
download | system_core-0ef3fd048aeaeb59467e43e543f66b96e4e6c7f5.zip system_core-0ef3fd048aeaeb59467e43e543f66b96e4e6c7f5.tar.gz system_core-0ef3fd048aeaeb59467e43e543f66b96e4e6c7f5.tar.bz2 |
adb: add -s option to adb install for installing apps on SD card.
Change-Id: Ic6b24411e594d160ddcf862cc9f1283e1e17bb4d
Signed-off-by: Mike Lockwood <lockwood@android.com>
-rw-r--r-- | adb/commandline.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/adb/commandline.c b/adb/commandline.c index 5756752..0352cf2 100644 --- a/adb/commandline.c +++ b/adb/commandline.c @@ -126,9 +126,10 @@ void help() " dev:<character device name>\n" " jdwp:<process pid> (remote only)\n" " adb jdwp - list PIDs of processes hosting a JDWP transport\n" - " adb install [-l] [-r] <file> - push this package file to the device and install it\n" + " adb install [-l] [-r] [-s] <file> - push this package file to the device and install it\n" " ('-l' means forward-lock the app)\n" " ('-r' means reinstall the app, keeping its data)\n" + " ('-s' means install on SD card instead of internal storage)\n" " adb uninstall [-k] <package> - remove this app package from the device\n" " ('-k' means keep the data and cache directories)\n" " adb bugreport - return all information from the device\n" @@ -1255,17 +1256,25 @@ int install_app(transport_type transport, char* serial, int argc, char** argv) { struct stat st; int err; - const char *const WHERE = "/data/local/tmp/%s"; + const char *const DATA_DEST = "/data/local/tmp/%s"; + const char *const SD_DEST = "/sdcard/tmp/%s"; + const char* where = DATA_DEST; char to[PATH_MAX]; char* filename = argv[argc - 1]; const char* p; + int i; + + for (i = 0; i < argc; i++) { + if (!strcmp(argv[i], "-s")) + where = SD_DEST; + } p = adb_dirstop(filename); if (p) { p++; - snprintf(to, sizeof to, WHERE, p); + snprintf(to, sizeof to, where, p); } else { - snprintf(to, sizeof to, WHERE, filename); + snprintf(to, sizeof to, where, filename); } if (p[0] == '\0') { } |