merged with phonegap
This commit is contained in:
commit
5690b10635
@ -41,9 +41,12 @@ $ npm install -g ios-deploy
|
|||||||
-o, --upload <file> upload file
|
-o, --upload <file> upload file
|
||||||
-w, --download download app tree
|
-w, --download download app tree
|
||||||
-2, --to <target pathname> use together with up/download file/tree. specify target
|
-2, --to <target pathname> use together with up/download file/tree. specify target
|
||||||
|
-D, --mkdir <dir> make directory on device
|
||||||
|
-R, --rm <path> remove file or directory on device (directories must be empty)
|
||||||
-V, --version print the executable version
|
-V, --version print the executable version
|
||||||
-e, --exists check if the app with given bundle_id is installed or not
|
-e, --exists check if the app with given bundle_id is installed or not
|
||||||
|
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
The commands below assume that you have an app called `my.app` with bundle id `bundle.id`. Substitute where necessary.
|
The commands below assume that you have an app called `my.app` with bundle id `bundle.id`. Substitute where necessary.
|
||||||
|
59
ios-deploy.c
59
ios-deploy.c
@ -16,7 +16,7 @@
|
|||||||
#include <netinet/tcp.h>
|
#include <netinet/tcp.h>
|
||||||
#include "MobileDevice.h"
|
#include "MobileDevice.h"
|
||||||
|
|
||||||
#define APP_VERSION "1.5.1"
|
#define APP_VERSION "1.5.2"
|
||||||
#define PREP_CMDS_PATH "/tmp/fruitstrap-lldb-prep-cmds-"
|
#define PREP_CMDS_PATH "/tmp/fruitstrap-lldb-prep-cmds-"
|
||||||
#define LLDB_SHELL "lldb -s " PREP_CMDS_PATH
|
#define LLDB_SHELL "lldb -s " PREP_CMDS_PATH
|
||||||
/*
|
/*
|
||||||
@ -435,6 +435,18 @@ CFStringRef get_device_full_name(const AMDeviceRef device) {
|
|||||||
fprintCFSTR(stdout, CFSTR("Device Name:[%@]\n"), device_name);
|
fprintCFSTR(stdout, CFSTR("Device Name:[%@]\n"), device_name);
|
||||||
if (model_name != NULL)
|
if (model_name != NULL)
|
||||||
fprintCFSTR(stdout, CFSTR("Model Name:[%@]\n"), model_name);
|
fprintCFSTR(stdout, CFSTR("Model Name:[%@]\n"), model_name);
|
||||||
|
char *devName = MYCFStringCopyUTF8String(device_name);
|
||||||
|
printf("Device Name:[%s]\n",devName);
|
||||||
|
CFShow(device_name);
|
||||||
|
printf("\n");
|
||||||
|
free(devName);
|
||||||
|
|
||||||
|
char *mdlName = MYCFStringCopyUTF8String(model_name);
|
||||||
|
printf("Model Name:[%s]\n",mdlName);
|
||||||
|
printf("MM: [%s]\n",CFStringGetCStringPtr(model_name, kCFStringEncodingUTF8));
|
||||||
|
CFShow(model_name);
|
||||||
|
printf("\n");
|
||||||
|
free(mdlName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(device_name != NULL && model_name != NULL)
|
if(device_name != NULL && model_name != NULL)
|
||||||
@ -1464,6 +1476,33 @@ void upload_file(AMDeviceRef device) {
|
|||||||
free(file_content);
|
free(file_content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void make_directory(AMDeviceRef device) {
|
||||||
|
service_conn_t houseFd = start_house_arrest_service(device);
|
||||||
|
|
||||||
|
afc_file_ref file_ref;
|
||||||
|
|
||||||
|
afc_connection afc_conn;
|
||||||
|
afc_connection* afc_conn_p = &afc_conn;
|
||||||
|
AFCConnectionOpen(houseFd, 0, &afc_conn_p);
|
||||||
|
|
||||||
|
assert(AFCDirectoryCreate(afc_conn_p, target_filename) == 0);
|
||||||
|
assert(AFCConnectionClose(afc_conn_p) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void remove_path(AMDeviceRef device) {
|
||||||
|
service_conn_t houseFd = start_house_arrest_service(device);
|
||||||
|
|
||||||
|
afc_file_ref file_ref;
|
||||||
|
|
||||||
|
afc_connection afc_conn;
|
||||||
|
afc_connection* afc_conn_p = &afc_conn;
|
||||||
|
AFCConnectionOpen(houseFd, 0, &afc_conn_p);
|
||||||
|
|
||||||
|
|
||||||
|
assert(AFCRemovePath(afc_conn_p, target_filename) == 0);
|
||||||
|
assert(AFCConnectionClose(afc_conn_p) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
void handle_device(AMDeviceRef device) {
|
void handle_device(AMDeviceRef device) {
|
||||||
//if (found_device)
|
//if (found_device)
|
||||||
// return; // handle one device only
|
// return; // handle one device only
|
||||||
@ -1499,6 +1538,10 @@ void handle_device(AMDeviceRef device) {
|
|||||||
upload_file(device);
|
upload_file(device);
|
||||||
} else if (strcmp("download", command) == 0) {
|
} else if (strcmp("download", command) == 0) {
|
||||||
download_tree(device);
|
download_tree(device);
|
||||||
|
} else if (strcmp("mkdir", command) == 0) {
|
||||||
|
make_directory(device);
|
||||||
|
} else if (strcmp("rm", command) == 0) {
|
||||||
|
remove_path(device);
|
||||||
} else if (strcmp("exists", command) == 0) {
|
} else if (strcmp("exists", command) == 0) {
|
||||||
exit(app_exists(device));
|
exit(app_exists(device));
|
||||||
}
|
}
|
||||||
@ -1681,6 +1724,8 @@ void usage(const char* app) {
|
|||||||
" -o, --upload <file> upload file\n"
|
" -o, --upload <file> upload file\n"
|
||||||
" -w, --download download app tree\n"
|
" -w, --download download app tree\n"
|
||||||
" -2, --to <target pathname> use together with up/download file/tree. specify target\n"
|
" -2, --to <target pathname> use together with up/download file/tree. specify target\n"
|
||||||
|
" -D, --mkdir <dir> make directory on device\n"
|
||||||
|
" -R, --rm <path> remove file or directory on device (directories must be empty)\n"
|
||||||
" -V, --version print the executable version \n"
|
" -V, --version print the executable version \n"
|
||||||
" -e, --exists check if the app with given bundle_id is installed or not \n",
|
" -e, --exists check if the app with given bundle_id is installed or not \n",
|
||||||
app);
|
app);
|
||||||
@ -1712,6 +1757,8 @@ int main(int argc, char *argv[]) {
|
|||||||
{ "upload", required_argument, NULL, 'o'},
|
{ "upload", required_argument, NULL, 'o'},
|
||||||
{ "download", optional_argument, NULL, 'w'},
|
{ "download", optional_argument, NULL, 'w'},
|
||||||
{ "to", required_argument, NULL, '2'},
|
{ "to", required_argument, NULL, '2'},
|
||||||
|
{ "mkdir", required_argument, NULL, 'D'},
|
||||||
|
{ "rm", required_argument, NULL, 'R'},
|
||||||
{ "exists", no_argument, NULL, 'e'},
|
{ "exists", no_argument, NULL, 'e'},
|
||||||
{ NULL, 0, NULL, 0 },
|
{ NULL, 0, NULL, 0 },
|
||||||
};
|
};
|
||||||
@ -1789,6 +1836,16 @@ int main(int argc, char *argv[]) {
|
|||||||
command = "download";
|
command = "download";
|
||||||
list_root = optarg;
|
list_root = optarg;
|
||||||
break;
|
break;
|
||||||
|
case 'D':
|
||||||
|
command_only = true;
|
||||||
|
target_filename = optarg;
|
||||||
|
command = "mkdir";
|
||||||
|
break;
|
||||||
|
case 'R':
|
||||||
|
command_only = true;
|
||||||
|
target_filename = optarg;
|
||||||
|
command = "rm";
|
||||||
|
break;
|
||||||
case 'e':
|
case 'e':
|
||||||
command_only = true;
|
command_only = true;
|
||||||
command = "exists";
|
command = "exists";
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ios-deploy",
|
"name": "ios-deploy",
|
||||||
"version": "1.5.1",
|
"version": "1.5.2",
|
||||||
"description": "launch iOS apps iOS devices from the command line (Xcode 6)",
|
"description": "launch iOS apps iOS devices from the command line (Xcode 6)",
|
||||||
"main": "ios-deploy",
|
"main": "ios-deploy",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user