fbd-feedback-manager: Make sure theme path components are '/' separated
Previously, assembly of the theme paths for custom paths (based on `XDG_DATA_DIRS`) was performed using `g_strconcat`, which produced erroneous file paths with missing path separators due to a typo in the code. Instead, make use of `g_build_filename` to assemble the theme paths from `XDG_DATA_DIRS` to look for custom themes, which automatically introduces host-specific path separators between individual path components. This introduces another temporary variable to ensure that the filename (which is itself assembled from a name and the file ending) isn't mangled by introduction of a path separator between these two "parts".
This commit is contained in:
@@ -454,8 +454,12 @@ find_themefile (void)
|
||||
// Iterate over $XDG_DATA_DIRS
|
||||
for (i = 0; i < g_strv_length (xdg_data_dirs); i++) {
|
||||
g_autofree gchar *config_path = NULL;
|
||||
g_autofree gchar *theme_file_name = NULL;
|
||||
|
||||
config_path = g_strconcat (xdg_data_dirs[i], "feedbackd/themes/", comp, ".json", NULL);
|
||||
// We leave it to g_build_filename to add/remove erroneous path separators
|
||||
theme_file_name = g_strconcat (comp, ".json", NULL);
|
||||
config_path = g_build_filename (xdg_data_dirs[i], "feedbackd", "themes",
|
||||
theme_file_name, NULL);
|
||||
g_debug ("Searching for device specific themefile in %s", config_path);
|
||||
|
||||
// Check if file exist
|
||||
|
||||
Reference in New Issue
Block a user