From 60b2395940b2e4fa0d8a62c17d51ca286e445b09 Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch
Date: Thu, 21 Jul 2022 09:50:43 +0200 Subject: Mildly improve Windows portability --- xdg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xdg.c b/xdg.c index 503b9a1..d412f61 100644 --- a/xdg.c +++ b/xdg.c @@ -45,7 +45,7 @@ char * get_xdg_home_dir(const char *var, const char *default_) { const char *env = getenv(var); - if (env && *env == '/') + if (env && g_path_is_absolute(env)) return g_strdup(env); // The specification doesn't handle a missing HOME variable explicitly. @@ -65,9 +65,9 @@ get_xdg_data_dirs(void) if (!(xdg_data_dirs = getenv("XDG_DATA_DIRS")) || !*xdg_data_dirs) xdg_data_dirs = "/usr/local/share/:/usr/share/"; - gchar **candidates = g_strsplit(xdg_data_dirs, ":", 0); + gchar **candidates = g_strsplit(xdg_data_dirs, G_SEARCHPATH_SEPARATOR_S, 0); for (gchar **p = candidates; *p; p++) { - if (**p == '/') + if (g_path_is_absolute(*p)) g_ptr_array_add(output, *p); else g_free(*p); -- cgit v1.2.3-70-g09d2