minor cleaning
This commit is contained in:
parent
1f4944abb4
commit
72b654992d
1 changed files with 25 additions and 51 deletions
|
@ -22,7 +22,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// $Id: fluxbox.cc,v 1.183 2003/08/12 01:04:16 fluxgen Exp $
|
// $Id: fluxbox.cc,v 1.184 2003/08/12 21:00:54 fluxgen Exp $
|
||||||
|
|
||||||
#include "fluxbox.hh"
|
#include "fluxbox.hh"
|
||||||
|
|
||||||
|
@ -357,7 +357,21 @@ getString() {
|
||||||
}
|
}
|
||||||
|
|
||||||
static Window last_bad_window = None;
|
static Window last_bad_window = None;
|
||||||
|
namespace {
|
||||||
|
void copyFile(const std::string &from, const std::string &to) {
|
||||||
|
ifstream from_file(from.c_str());
|
||||||
|
ofstream to_file(to.c_str());
|
||||||
|
|
||||||
|
if (! to_file.good()) {
|
||||||
|
cerr<<"Can't write file: "<<to<<endl;
|
||||||
|
} else if (from_file.good()) {
|
||||||
|
to_file<<from_file.rdbuf(); //copy file
|
||||||
|
} else {
|
||||||
|
cerr<<"Can't copy from "<<from<<" to "<<to<<endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
static int handleXErrors(Display *d, XErrorEvent *e) {
|
static int handleXErrors(Display *d, XErrorEvent *e) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -651,7 +665,7 @@ void Fluxbox::setupConfigFiles() {
|
||||||
|
|
||||||
bool create_init = false, create_keys = false, create_menu = false;
|
bool create_init = false, create_keys = false, create_menu = false;
|
||||||
|
|
||||||
string dirname = getenv("HOME")+string("/.")+string(m_RC_PATH) + "/";
|
string dirname = getenv("HOME") + string("/.") + string(m_RC_PATH) + "/";
|
||||||
string init_file, keys_file, menu_file, slitlist_file;
|
string init_file, keys_file, menu_file, slitlist_file;
|
||||||
init_file = dirname + m_RC_INIT_FILE;
|
init_file = dirname + m_RC_INIT_FILE;
|
||||||
keys_file = dirname + "keys";
|
keys_file = dirname + "keys";
|
||||||
|
@ -686,58 +700,18 @@ void Fluxbox::setupConfigFiles() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// should we copy key configuraion?
|
// copy key configuration
|
||||||
if (create_keys) {
|
if (create_keys)
|
||||||
ifstream from(DEFAULTKEYSFILE);
|
copyFile(DEFAULTKEYSFILE, keys_file);
|
||||||
ofstream to(keys_file.c_str());
|
|
||||||
|
|
||||||
if (! to.good()) {
|
// copy menu configuration
|
||||||
cerr << "Can't write file" << endl;
|
if (create_menu)
|
||||||
} else if (from.good()) {
|
copyFile(DEFAULTMENU, menu_file);
|
||||||
#ifdef DEBUG
|
|
||||||
cerr << "Copying file: " << DEFAULTKEYSFILE << endl;
|
|
||||||
#endif // DEBUG
|
|
||||||
to<<from.rdbuf(); //copy file
|
|
||||||
|
|
||||||
} else {
|
// copy init file
|
||||||
cerr<<"Can't copy default keys file."<<endl;
|
if (create_init)
|
||||||
}
|
copyFile(DEFAULT_INITFILE, init_file);
|
||||||
}
|
|
||||||
|
|
||||||
// should we copy menu configuraion?
|
|
||||||
if (create_menu) {
|
|
||||||
ifstream from(DEFAULTMENU);
|
|
||||||
ofstream to(menu_file.c_str());
|
|
||||||
|
|
||||||
if (! to.good()) {
|
|
||||||
cerr << "Can't open " << menu_file.c_str() << "for writing" << endl;
|
|
||||||
} else if (from.good()) {
|
|
||||||
#ifdef DEBUG
|
|
||||||
cerr << "Copying file: " << DEFAULTMENU << endl;
|
|
||||||
#endif // DEBUG
|
|
||||||
to<<from.rdbuf(); //copy file
|
|
||||||
|
|
||||||
} else {
|
|
||||||
cerr<<"Can't copy default menu file."<<endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// should we copy default init file?
|
|
||||||
if (create_init) {
|
|
||||||
ifstream from(DEFAULT_INITFILE);
|
|
||||||
ofstream to(init_file.c_str());
|
|
||||||
|
|
||||||
if (! to.good()) {
|
|
||||||
cerr << "Can't open " << init_file.c_str() << "for writing" << endl;
|
|
||||||
} else if (from.good()) {
|
|
||||||
#ifdef DEBUG
|
|
||||||
cerr << "Copying file: " << DEFAULT_INITFILE << endl;
|
|
||||||
#endif // DEBUG
|
|
||||||
to<<from.rdbuf(); //copy file
|
|
||||||
} else {
|
|
||||||
cerr<<"Can't copy default init file."<<endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Fluxbox::handleEvent(XEvent * const e) {
|
void Fluxbox::handleEvent(XEvent * const e) {
|
||||||
|
|
Loading…
Reference in a new issue