diff options
author | Ryan Pavlik <rpavlik@iastate.edu> | 2011-10-28 21:15:13 (GMT) |
---|---|---|
committer | Ryan Pavlik <rpavlik@iastate.edu> | 2011-10-31 15:54:32 (GMT) |
commit | 25d04827b5e754c4d898240de8676eb89d105eb6 (patch) | |
tree | 2af67f2c48f4891f9c3db045e07d34b50ced668b /src | |
parent | f77f5d461ba22f9e4c2af85c8666501207c163c0 (diff) | |
download | fluxbox_pavel-25d04827b5e754c4d898240de8676eb89d105eb6.zip fluxbox_pavel-25d04827b5e754c4d898240de8676eb89d105eb6.tar.bz2 |
main.cc,FbTk/StringUtil.cc: On windows, use USERPROFILE instead of HOME
Diffstat (limited to 'src')
-rw-r--r-- | src/FbTk/StringUtil.cc | 4 | ||||
-rw-r--r-- | src/main.cc | 5 |
2 files changed, 8 insertions, 1 deletions
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) { | |||
175 | string retval; | 175 | string retval; |
176 | size_t pos = filename.find_first_not_of(" \t"); | 176 | size_t pos = filename.find_first_not_of(" \t"); |
177 | if (pos != string::npos && filename[pos] == '~') { | 177 | if (pos != string::npos && filename[pos] == '~') { |
178 | #ifdef _WIN32 | ||
179 | retval = getenv("USERPROFILE"); | ||
180 | #else | ||
178 | retval = getenv("HOME"); | 181 | retval = getenv("HOME"); |
182 | #endif | ||
179 | if (pos + 1 < filename.size()) { | 183 | if (pos + 1 < filename.size()) { |
180 | // copy from the character after '~' | 184 | // copy from the character after '~' |
181 | retval += static_cast<const char *>(filename.c_str() + pos + 1); | 185 | retval += static_cast<const char *>(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 { | |||
224 | if (env && strlen(env) > 0) { | 224 | if (env && strlen(env) > 0) { |
225 | session_display.assign(env); | 225 | session_display.assign(env); |
226 | } | 226 | } |
227 | 227 | #ifdef _WIN32 | |
228 | env = getenv("USERPROFILE"); | ||
229 | #else | ||
228 | env = getenv("HOME"); | 230 | env = getenv("HOME"); |
231 | #endif | ||
229 | if (env && strlen(env) > 0) { | 232 | if (env && strlen(env) > 0) { |
230 | rc_path.assign(std::string(env) + "/." + realProgramName("fluxbox")); | 233 | rc_path.assign(std::string(env) + "/." + realProgramName("fluxbox")); |
231 | rc_file = rc_path + "/init"; | 234 | rc_file = rc_path + "/init"; |