aboutsummaryrefslogtreecommitdiff
path: root/src/main.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cc')
-rw-r--r--src/main.cc22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/main.cc b/src/main.cc
index c47e1d8..7541a28 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -34,6 +34,7 @@
34#include "FbTk/I18n.hh" 34#include "FbTk/I18n.hh"
35#include "FbTk/CommandParser.hh" 35#include "FbTk/CommandParser.hh"
36#include "FbTk/FileUtil.hh" 36#include "FbTk/FileUtil.hh"
37#include "FbTk/StringUtil.hh"
37 38
38//use GNU extensions 39//use GNU extensions
39#ifndef _GNU_SOURCE 40#ifndef _GNU_SOURCE
@@ -114,22 +115,22 @@ static void showInfo(ostream &ostr) {
114 115
115 ostr <<_FB_CONSOLETEXT(Common, DefaultMenuFile, " menu", "default menu file (right aligned - make sure same width as other default values)") 116 ostr <<_FB_CONSOLETEXT(Common, DefaultMenuFile, " menu", "default menu file (right aligned - make sure same width as other default values)")
116 << ": " 117 << ": "
117 << DEFAULTMENU << endl; 118 << FbTk::StringUtil::expandFilename(DEFAULTMENU) << endl;
118 ostr << _FB_CONSOLETEXT(Common, DefaultStyle, " style", "default style (right aligned - make sure same width as other default values)") 119 ostr << _FB_CONSOLETEXT(Common, DefaultStyle, " style", "default style (right aligned - make sure same width as other default values)")
119 << ": " 120 << ": "
120 << DEFAULTSTYLE << endl; 121 << FbTk::StringUtil::expandFilename(DEFAULTSTYLE) << endl;
121 122
122 ostr << _FB_CONSOLETEXT(Common, DefaultKeyFile, " keys", "default key file (right aligned - make sure same width as other default values)") 123 ostr << _FB_CONSOLETEXT(Common, DefaultKeyFile, " keys", "default key file (right aligned - make sure same width as other default values)")
123 << ": " 124 << ": "
124 << DEFAULTKEYSFILE << endl; 125 << FbTk::StringUtil::expandFilename(DEFAULTKEYSFILE) << endl;
125 ostr << _FB_CONSOLETEXT(Common, DefaultInitFile, " init", "default init file (right aligned - make sure same width as other default values)") 126 ostr << _FB_CONSOLETEXT(Common, DefaultInitFile, " init", "default init file (right aligned - make sure same width as other default values)")
126 << ": " 127 << ": "
127 << DEFAULT_INITFILE << endl; 128 << FbTk::StringUtil::expandFilename(DEFAULT_INITFILE) << endl;
128 129
129#ifdef NLS 130#ifdef NLS
130 ostr << _FB_CONSOLETEXT(Common, DefaultLocalePath, " nls", "location for localization files (right aligned - make sure same width as other default values)") 131 ostr << _FB_CONSOLETEXT(Common, DefaultLocalePath, " nls", "location for localization files (right aligned - make sure same width as other default values)")
131 << ": " 132 << ": "
132 << LOCALEPATH << endl; 133 << FbTk::StringUtil::expandFilename(LOCALEPATH) << endl;
133#endif 134#endif
134 135
135 const char NOT[] = "-"; 136 const char NOT[] = "-";
@@ -220,12 +221,12 @@ struct Options {
220 const char* env; 221 const char* env;
221 222
222 env = getenv("DISPLAY"); 223 env = getenv("DISPLAY");
223 if (env) { 224 if (env && strlen(env) > 0) {
224 session_display.assign(env); 225 session_display.assign(env);
225 } 226 }
226 227
227 env = getenv("HOME"); 228 env = getenv("HOME");
228 if (env) { 229 if (env && strlen(env) > 0) {
229 rc_path.assign(std::string(env) + "/." + realProgramName("fluxbox")); 230 rc_path.assign(std::string(env) + "/." + realProgramName("fluxbox"));
230 rc_file = rc_path + "/init"; 231 rc_file = rc_path + "/init";
231 } 232 }
@@ -369,14 +370,15 @@ void setupConfigFiles(const std::string& dirname, const std::string& rc) {
369 // copy default files if needed 370 // copy default files if needed
370 for (size_t i = 0; i < nr_of_cfiles; ++i) { 371 for (size_t i = 0; i < nr_of_cfiles; ++i) {
371 if (cfiles[i].create_file) { 372 if (cfiles[i].create_file) {
372 FbTk::FileUtil::copyFile(cfiles[i].default_name, cfiles[i].filename.c_str()); 373 FbTk::FileUtil::copyFile(FbTk::StringUtil::expandFilename(cfiles[i].default_name).c_str(), cfiles[i].filename.c_str());
373 sync_fs = true; 374 sync_fs = true;
374 } 375 }
375 } 376 }
376 377#ifdef HAVE_SYNC
377 if (sync_fs) { 378 if (sync_fs) {
378 sync(); 379 sync();
379 } 380 }
381#endif
380} 382}
381 383
382 384
@@ -413,7 +415,9 @@ void updateConfigFilesIfNeeded(const std::string& rc_file) {
413 << commandargs 415 << commandargs
414 << "' failed." << endl; 416 << "' failed." << endl;
415 } 417 }
418#ifdef HAVE_SYNC
416 sync(); 419 sync();
420#endif // HAVE_SYNC
417 } 421 }
418} 422}
419 423