am a1c344b9: Merge "Move mkdirs to adb_utils."
* commit 'a1c344b9de508dda83f60f9dea6559e7b6ea6c28': Move mkdirs to adb_utils.
This commit is contained in:
commit
c06c300115
4 changed files with 22 additions and 38 deletions
|
|
@ -63,6 +63,25 @@ std::string escape_arg(const std::string& s) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int mkdirs(const char *path)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
char *x = (char *)path + 1;
|
||||||
|
|
||||||
|
for(;;) {
|
||||||
|
x = adb_dirstart(x);
|
||||||
|
if(x == 0) return 0;
|
||||||
|
*x = 0;
|
||||||
|
ret = adb_mkdir(path, 0775);
|
||||||
|
*x = OS_PATH_SEPARATOR;
|
||||||
|
if((ret < 0) && (errno != EEXIST)) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
x++;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void dump_hex(const void* data, size_t byte_count) {
|
void dump_hex(const void* data, size_t byte_count) {
|
||||||
byte_count = std::min(byte_count, size_t(16));
|
byte_count = std::min(byte_count, size_t(16));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@
|
||||||
bool getcwd(std::string* cwd);
|
bool getcwd(std::string* cwd);
|
||||||
bool directory_exists(const std::string& path);
|
bool directory_exists(const std::string& path);
|
||||||
|
|
||||||
|
int mkdirs(const char *path);
|
||||||
|
|
||||||
std::string escape_arg(const std::string& s);
|
std::string escape_arg(const std::string& s);
|
||||||
|
|
||||||
void dump_hex(const void* ptr, size_t byte_count);
|
void dump_hex(const void* ptr, size_t byte_count);
|
||||||
|
|
|
||||||
|
|
@ -724,25 +724,6 @@ static int logcat(TransportType transport, const char* serial, int argc, const c
|
||||||
return send_shell_command(transport, serial, cmd);
|
return send_shell_command(transport, serial, cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mkdirs(const char *path)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
char *x = (char *)path + 1;
|
|
||||||
|
|
||||||
for(;;) {
|
|
||||||
x = adb_dirstart(x);
|
|
||||||
if(x == 0) return 0;
|
|
||||||
*x = 0;
|
|
||||||
ret = adb_mkdir(path, 0775);
|
|
||||||
*x = OS_PATH_SEPARATOR;
|
|
||||||
if((ret < 0) && (errno != EEXIST)) {
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
x++;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int backup(int argc, const char** argv) {
|
static int backup(int argc, const char** argv) {
|
||||||
const char* filename = "./backup.ab";
|
const char* filename = "./backup.ab";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@
|
||||||
#include "adb.h"
|
#include "adb.h"
|
||||||
#include "adb_client.h"
|
#include "adb_client.h"
|
||||||
#include "adb_io.h"
|
#include "adb_io.h"
|
||||||
|
#include "adb_utils.h"
|
||||||
#include "file_sync_service.h"
|
#include "file_sync_service.h"
|
||||||
|
|
||||||
static unsigned long long total_bytes;
|
static unsigned long long total_bytes;
|
||||||
|
|
@ -395,25 +396,6 @@ fail:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mkdirs(const char *name)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
char *x = (char *)name + 1;
|
|
||||||
|
|
||||||
for(;;) {
|
|
||||||
x = adb_dirstart(x);
|
|
||||||
if(x == 0) return 0;
|
|
||||||
*x = 0;
|
|
||||||
ret = adb_mkdir(name, 0775);
|
|
||||||
*x = OS_PATH_SEPARATOR;
|
|
||||||
if((ret < 0) && (errno != EEXIST)) {
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
x++;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int sync_recv(int fd, const char* rpath, const char* lpath, int show_progress) {
|
static int sync_recv(int fd, const char* rpath, const char* lpath, int show_progress) {
|
||||||
syncmsg msg;
|
syncmsg msg;
|
||||||
int len;
|
int len;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue