From deca1f9cbff62574843a898b97633fec530e3a6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alicia=20Boya=20Garc=C3=ADa?= Date: Fri, 25 Oct 2019 12:45:40 +0200 Subject: [PATCH] validateflow: Don't use colon in file names The colon character commonly used to separate the element name and the pad name is reserved in Windows filesystems, so it's better to use something safer. This patch replaces it with '-'. Please update gst-integration-testsuites too where another commit has renamed all the files. --- validate/plugins/flow/gstvalidateflow.c | 29 +++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/validate/plugins/flow/gstvalidateflow.c b/validate/plugins/flow/gstvalidateflow.c index 90957a0abd..687003852d 100644 --- a/validate/plugins/flow/gstvalidateflow.c +++ b/validate/plugins/flow/gstvalidateflow.c @@ -206,6 +206,29 @@ parse_caps_properties_setting (const ValidateFlowOverride * flow, return parsed_list; } +static gchar * +make_safe_file_name (const gchar * name) +{ + gchar *ret = g_strdup (name); + gchar *c; + for (c = ret; *c; c++) { + switch (*c) { + case '<': + case '>': + case ':': + case '"': + case '/': + case '\\': + case '|': + case '?': + case '*': + *c = '-'; + break; + } + } + return ret; +} + static ValidateFlowOverride * validate_flow_override_new (GstStructure * config) { @@ -276,10 +299,11 @@ validate_flow_override_new (GstStructure * config) flow->actual_results_dir = g_strdup ("."); { + gchar *pad_name_safe = make_safe_file_name (flow->pad_name); gchar *expectations_file_name = - g_strdup_printf ("log-%s-expected", flow->pad_name); + g_strdup_printf ("log-%s-expected", pad_name_safe); gchar *actual_results_file_name = - g_strdup_printf ("log-%s-actual", flow->pad_name); + g_strdup_printf ("log-%s-actual", pad_name_safe); flow->expectations_file_path = g_build_path (G_DIR_SEPARATOR_S, flow->expectations_dir, expectations_file_name, NULL); @@ -288,6 +312,7 @@ validate_flow_override_new (GstStructure * config) actual_results_file_name, NULL); g_free (expectations_file_name); g_free (actual_results_file_name); + g_free (pad_name_safe); } if (g_file_test (flow->expectations_file_path, G_FILE_TEST_EXISTS)) {