From 1d07631cfbd6d29deb59655ee56d00a2eef344d7 Mon Sep 17 00:00:00 2001 From: Daniel Carl Date: Wed, 12 Mar 2014 20:44:05 +0100 Subject: [PATCH] Replace G_DIR_SEPARATOR by / this is easier to read. --- src/setting.c | 4 ++-- src/util.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/setting.c b/src/setting.c index c76325e..1586678 100644 --- a/src/setting.c +++ b/src/setting.c @@ -672,8 +672,8 @@ static SettingStatus download_path(const Setting *s, const SettingType type) vb.config.download_dir = NULL; } path = util_expand(s->arg.s); - /* if path is not absolute create it in the home directory */ - if (*path != G_DIR_SEPARATOR) { + /* if path is not absolute set it in the home directory */ + if (*path != '/') { vb.config.download_dir = g_build_filename(util_get_home_dir(), path, NULL); g_free(path); } else { diff --git a/src/util.c b/src/util.c index 38212d6..63f0654 100644 --- a/src/util.c +++ b/src/util.c @@ -303,7 +303,7 @@ char *util_build_path(const char *path, const char *dir) /* if the path could be expanded */ if ((fexp = util_expand(path))) { - if (*fexp == G_DIR_SEPARATOR) { + if (*fexp == '/') { /* path is already absolute, no need to use given dir - there is * no need to free fexp, bacuse this should be done by the caller * on fullPath later */ @@ -324,7 +324,7 @@ char *util_build_path(const char *path, const char *dir) fullPath = g_build_filename(g_get_current_dir(), path, NULL); } - if ((p = strrchr(fullPath, G_DIR_SEPARATOR))) { + if ((p = strrchr(fullPath, '/'))) { *p = '\0'; util_create_dir_if_not_exists(fullPath); *p = '/'; @@ -353,12 +353,12 @@ char *util_expand(const char *src) if (*src == '~' && start) { /* skip the ~ */ src++; - if (*src == G_DIR_SEPARATOR) { + if (*src == '/') { g_string_append(dst, util_get_home_dir()); } else { name = g_string_new(""); /* look ahead to / space or end of string */ - while (*src && *src != G_DIR_SEPARATOR && !VB_IS_SPACE(*src)) { + while (*src && *src != '/' && !VB_IS_SPACE(*src)) { g_string_append_c(name, *src); src++; } -- 2.20.1