main.cc,FbTk/StringUtil.cc: On windows, use USERPROFILE instead of HOME

This commit is contained in:
Ryan Pavlik 2011-10-28 16:15:13 -05:00
parent f77f5d461b
commit 25d04827b5
2 changed files with 8 additions and 1 deletions

View file

@ -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<const char *>(filename.c_str() + pos + 1);

View file

@ -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";