From 25d04827b5e754c4d898240de8676eb89d105eb6 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Fri, 28 Oct 2011 16:15:13 -0500 Subject: main.cc,FbTk/StringUtil.cc: On windows, use USERPROFILE instead of HOME --- src/FbTk/StringUtil.cc | 4 ++++ src/main.cc | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/FbTk/StringUtil.cc b/src/FbTk/StringUtil.cc index f76a1f9..ec1f936 100644 --- a/src/FbTk/StringUtil.cc +++ b/src/FbTk/StringUtil.cc @@ -175,7 +175,11 @@ string expandFilename(const string &filename) { string retval; size_t pos = filename.find_first_not_of(" \t"); if (pos != string::npos && filename[pos] == '~') { +#ifdef _WIN32 + retval = getenv("USERPROFILE"); +#else retval = getenv("HOME"); +#endif if (pos + 1 < filename.size()) { // copy from the character after '~' retval += static_cast(filename.c_str() + pos + 1); diff --git a/src/main.cc b/src/main.cc index f294db3..8aea835 100644 --- a/src/main.cc +++ b/src/main.cc @@ -224,8 +224,11 @@ struct Options { if (env && strlen(env) > 0) { session_display.assign(env); } - +#ifdef _WIN32 + env = getenv("USERPROFILE"); +#else env = getenv("HOME"); +#endif if (env && strlen(env) > 0) { rc_path.assign(std::string(env) + "/." + realProgramName("fluxbox")); rc_file = rc_path + "/init"; -- cgit v0.11.2