Simplify bind directory creation.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22152 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-12-14 22:27:47 +00:00
parent d81b5c2994
commit 486ac10476

View File

@ -1737,18 +1737,18 @@ void PrefShortcuts::apply(LyXRC & rc) const
{
rc.bind_file = internal_path(fromqstr(bindFileED->text()));
// write user_bind and user_unbind to .lyx/bind/user.bind
string bind_dir = addPath(package().user_support().absFilename(), "bind");
if (!FileName(bind_dir).exists() && FileName(bind_dir).createDirectory(0777)) {
FileName bind_dir(addPath(package().user_support().absFilename(), "bind"));
if (!bind_dir.exists() && !bind_dir.createDirectory(0777)) {
lyxerr << "LyX could not create the user bind directory '"
<< bind_dir << "'. All user-defined key bindings will be lost." << endl;
return;
}
if (!FileName(bind_dir).isDirWritable()) {
if (!bind_dir.isDirWritable()) {
lyxerr << "LyX could not write to the user bind directory '"
<< bind_dir << "'. All user-defined key bindings will be lost." << endl;
return;
}
FileName user_bind_file = FileName(addName(bind_dir, "user.bind"));
FileName user_bind_file(bind_dir.absFilename() + "/user.bind");
user_bind_.write(user_bind_file.toFilesystemEncoding(), false, false);
user_unbind_.write(user_bind_file.toFilesystemEncoding(), true, true);
// immediately apply the keybindings. Why this is not done before?