diff options
author | Alexander Aksenov <a.aksenov@samsung.com> | 2014-08-26 18:59:37 +0400 |
---|---|---|
committer | Dmitry Kovalenko <d.kovalenko@samsung.com> | 2014-08-27 04:17:54 -0700 |
commit | 166b3cdf3bc9256bbcc567c862d02695e63b9941 (patch) | |
tree | ae09fcef041bcb451e1a5a365f6332c479565d88 | |
parent | 9dac3264113ccadc1f307308c4c2eaaae6f681b0 (diff) | |
download | swap-manager-166b3cdf3bc9256bbcc567c862d02695e63b9941.tar.gz swap-manager-166b3cdf3bc9256bbcc567c862d02695e63b9941.tar.bz2 swap-manager-166b3cdf3bc9256bbcc567c862d02695e63b9941.zip |
[IMPROVE] Protocol: add Windows-style path support
Only for debug path
Change-Id: Iedcc416472b9fed51a5aec9a540c90de45a6b9cb
Signed-off-by: Alexander Aksenov <a.aksenov@samsung.com>
-rw-r--r-- | daemon/da_protocol.c | 21 |
1 files 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 <sys/stat.h> #include <fcntl.h> #include <unistd.h> +#include <ctype.h> 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'; |