From: Michael Jeanson Date: Tue, 6 Jun 2017 18:56:30 +0000 (-0400) Subject: Port: replace literal '/' with G_DIR_SEPARATOR X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=3743a302979551dd5a384ab29144a8a0f237e091 Port: replace literal '/' with G_DIR_SEPARATOR Signed-off-by: Michael Jeanson Signed-off-by: Jérémie Galarneau --- diff --git a/plugins/ctf/fs-sink/write.c b/plugins/ctf/fs-sink/write.c index 519eb2cb..4b6f6e9a 100644 --- a/plugins/ctf/fs-sink/write.c +++ b/plugins/ctf/fs-sink/write.c @@ -248,7 +248,7 @@ int make_trace_path(struct writer_component *writer_component, } - snprintf(trace_path, PATH_MAX, "%s/%s", + snprintf(trace_path, PATH_MAX, "%s" G_DIR_SEPARATOR_S "%s", writer_component->base_path->str, trace_name); /* @@ -265,7 +265,7 @@ int make_trace_path(struct writer_component *writer_component, int i = 0; do { - snprintf(trace_path, PATH_MAX, "%s/%s-%d", + snprintf(trace_path, PATH_MAX, "%s" G_DIR_SEPARATOR_S "%s-%d", writer_component->base_path->str, trace_name, ++i); } while (g_file_test(trace_path, G_FILE_TEST_EXISTS) && i < INT_MAX); diff --git a/plugins/ctf/fs-src/fs.c b/plugins/ctf/fs-src/fs.c index 32121b73..d2c0ede3 100644 --- a/plugins/ctf/fs-src/fs.c +++ b/plugins/ctf/fs-src/fs.c @@ -782,13 +782,13 @@ int create_ds_file_groups(struct ctf_fs_trace *ctf_fs_trace) if (!strcmp(basename, CTF_FS_METADATA_FILENAME)) { /* Ignore the metadata stream. */ - BT_LOGD("Ignoring metadata file `%s/%s`", + BT_LOGD("Ignoring metadata file `%s" G_DIR_SEPARATOR_S "%s`", ctf_fs_trace->path->str, basename); continue; } if (basename[0] == '.') { - BT_LOGD("Ignoring hidden file `%s/%s`", + BT_LOGD("Ignoring hidden file `%s" G_DIR_SEPARATOR_S "%s`", ctf_fs_trace->path->str, basename); continue; } @@ -796,13 +796,13 @@ int create_ds_file_groups(struct ctf_fs_trace *ctf_fs_trace) /* Create the file. */ file = ctf_fs_file_create(); if (!file) { - BT_LOGE("Cannot create stream file object for file `%s/%s`", + BT_LOGE("Cannot create stream file object for file `%s" G_DIR_SEPARATOR_S "%s`", ctf_fs_trace->path->str, basename); goto error; } /* Create full path string. */ - g_string_append_printf(file->path, "%s/%s", + g_string_append_printf(file->path, "%s" G_DIR_SEPARATOR_S "%s", ctf_fs_trace->path->str, basename); if (!g_file_test(file->path->str, G_FILE_TEST_IS_REGULAR)) { BT_LOGD("Ignoring non-regular file `%s`", @@ -1004,7 +1004,7 @@ int path_is_ctf_trace(const char *path) goto end; } - g_string_printf(metadata_path, "%s/%s", path, CTF_FS_METADATA_FILENAME); + g_string_printf(metadata_path, "%s" G_DIR_SEPARATOR_S "%s", path, CTF_FS_METADATA_FILENAME); if (g_file_test(metadata_path->str, G_FILE_TEST_IS_REGULAR)) { ret = 1; @@ -1029,6 +1029,7 @@ int add_trace_path(GList **trace_paths, const char *path) goto end; } + // FIXME: Remove or ifdef for __MINGW32__ if (strcmp(norm_path->str, "/") == 0) { BT_LOGE("Opening a trace in `/` is not supported."); ret = -1; @@ -1098,7 +1099,7 @@ int ctf_fs_find_traces(GList **trace_paths, const char *start_path) goto end; } - g_string_printf(sub_path, "%s/%s", start_path, basename); + g_string_printf(sub_path, "%s" G_DIR_SEPARATOR_S "%s", start_path, basename); ret = ctf_fs_find_traces(trace_paths, sub_path->str); g_string_free(sub_path, TRUE); if (ret) { diff --git a/plugins/ctf/fs-src/metadata.c b/plugins/ctf/fs-src/metadata.c index 6ae43df9..cdc38deb 100644 --- a/plugins/ctf/fs-src/metadata.c +++ b/plugins/ctf/fs-src/metadata.c @@ -51,7 +51,7 @@ FILE *ctf_fs_metadata_open_file(const char *trace_path) goto end; } - g_string_append(metadata_path, "/" CTF_FS_METADATA_FILENAME); + g_string_append(metadata_path, G_DIR_SEPARATOR_S CTF_FS_METADATA_FILENAME); fp = fopen(metadata_path->str, "rb"); g_string_free(metadata_path, TRUE); end: @@ -67,7 +67,7 @@ static struct ctf_fs_file *get_file(const char *trace_path) } g_string_append(file->path, trace_path); - g_string_append(file->path, "/" CTF_FS_METADATA_FILENAME); + g_string_append(file->path, G_DIR_SEPARATOR_S CTF_FS_METADATA_FILENAME); if (ctf_fs_file_open(file, "rb")) { goto error;