From 166b3cdf3bc9256bbcc567c862d02695e63b9941 Mon Sep 17 00:00:00 2001 From: Alexander Aksenov Date: Tue, 26 Aug 2014 18:59:37 +0400 Subject: [IMPROVE] Protocol: add Windows-style path support Only for debug path Change-Id: Iedcc416472b9fed51a5aec9a540c90de45a6b9cb Signed-off-by: Alexander Aksenov --- daemon/da_protocol.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/daemon/da_protocol.c b/daemon/da_protocol.c index 098ccca..786ce19 100644 --- a/daemon/da_protocol.c +++ b/daemon/da_protocol.c @@ -52,6 +52,7 @@ #include #include #include +#include static pthread_mutex_t stop_all_mutex = PTHREAD_MUTEX_INITIALIZER; @@ -782,6 +783,22 @@ static const char* basename(const char *filename) return p ? p + 1 : NULL; } +/** + * Checks whether it is Windows-style path or not. + * + * @return 1 if path is Windows-style one, 0 otherwise. + */ +static int check_windows_path(const char *path) +{ + size_t len; + + len = strlen(path); + if (len > 3 && isalpha(path[0]) && !(strncmp(&(path[1]), ":\\", 2))) + return 1; + + return 0; +} + static struct binary_ack* binary_ack_alloc(const char *filename) { struct binary_ack *ba = malloc(sizeof(*ba)); @@ -795,8 +812,8 @@ static struct binary_ack* binary_ack_alloc(const char *filename) get_build_dir(builddir, filename); if (builddir[0] != '\0') - snprintf(binpath, sizeof(binpath), "%s/%s", - builddir, basename(filename) ?: ""); + snprintf(binpath, sizeof(binpath), check_windows_path(builddir) ? + "%s\\%s" : "%s/%s", builddir, basename(filename) ?: ""); else binpath[0] = '\0'; -- cgit v1.2.3