From 194e294d2c487df69a6023a25c923baac35266b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Mon, 28 Jan 2019 00:04:40 +0100 Subject: [PATCH] user-theme: Don't use concatenation to build filenames Since template strings were added in ES6, string concatenation is considered bad style. There's a catch though: xgettext currently has a nasty bug concerning the combination of backticks and slashes. Avoid that issue by building filenames with the corresponding GLib helper function. https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/49 --- extensions/user-theme/extension.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/extensions/user-theme/extension.js b/extensions/user-theme/extension.js index e0c2d57c..a3e382b6 100644 --- a/extensions/user-theme/extension.js +++ b/extensions/user-theme/extension.js @@ -36,7 +36,9 @@ class ThemeManager { let _themeName = this._settings.get_string(SETTINGS_KEY); if (_themeName) { - let _userCssStylesheet = GLib.get_home_dir() + '/.themes/' + _themeName + '/gnome-shell/gnome-shell.css'; + let _userCssStylesheet = GLib.build_filenamev([ + GLib.get_home_dir(), '.themes', _themeName, 'gnome-shell', 'gnome-shell.css' + ]); let file = Gio.file_new_for_path(_userCssStylesheet); if (file.query_exists(null)) _stylesheet = _userCssStylesheet; @@ -44,7 +46,9 @@ class ThemeManager { let sysdirs = GLib.get_system_data_dirs(); sysdirs.unshift(GLib.get_user_data_dir()); for (let i = 0; i < sysdirs.length; i++) { - _userCssStylesheet = sysdirs[i] + '/themes/' + _themeName + '/gnome-shell/gnome-shell.css'; + _userCssStylesheet = GLib.build_filenamev([ + sysdirs[i], 'themes', _themeName, 'gnome-shell', 'gnome-shell.css' + ]); let file = Gio.file_new_for_path(_userCssStylesheet); if (file.query_exists(null)) { _stylesheet = _userCssStylesheet;