From 05bd0e0dac688950e41a984492ec5b2ef4e86849 Mon Sep 17 00:00:00 2001 From: Ikey Doherty Date: Tue, 14 Nov 2017 21:17:47 +0000 Subject: [PATCH] common: Fix broken ikey mind - correctly build Steam path Thanks to @TingPing for bailing me out of my own insanity. Signed-off-by: Ikey Doherty --- src/common/files.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/common/files.c b/src/common/files.c index dbcaac9..568fbf5 100644 --- a/src/common/files.c +++ b/src/common/files.c @@ -75,13 +75,16 @@ static inline char *lsi_get_fallback_steam_dir(const char *home) { char *p = NULL; char *xdg_data = getenv("XDG_DATA_HOME"); + int r = 0; /* Respect the XDG_CONFIG_HOME variable if it is set */ if (xdg_data) { - return strdup(xdg_data); + r = asprintf(&p, "%s/Steam", xdg_data); + } else { + r = asprintf(&p, "%s/.local/share/Steam", home); } - if (asprintf(&p, "%s/.local/share/Steam", home) < 0) { + if (r < 0) { return NULL; } return p;