mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 13:31:49 +00:00
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:
parent
d81b5c2994
commit
486ac10476
@ -1737,18 +1737,18 @@ void PrefShortcuts::apply(LyXRC & rc) const
|
|||||||
{
|
{
|
||||||
rc.bind_file = internal_path(fromqstr(bindFileED->text()));
|
rc.bind_file = internal_path(fromqstr(bindFileED->text()));
|
||||||
// write user_bind and user_unbind to .lyx/bind/user.bind
|
// write user_bind and user_unbind to .lyx/bind/user.bind
|
||||||
string bind_dir = addPath(package().user_support().absFilename(), "bind");
|
FileName bind_dir(addPath(package().user_support().absFilename(), "bind"));
|
||||||
if (!FileName(bind_dir).exists() && FileName(bind_dir).createDirectory(0777)) {
|
if (!bind_dir.exists() && !bind_dir.createDirectory(0777)) {
|
||||||
lyxerr << "LyX could not create the user bind directory '"
|
lyxerr << "LyX could not create the user bind directory '"
|
||||||
<< bind_dir << "'. All user-defined key bindings will be lost." << endl;
|
<< bind_dir << "'. All user-defined key bindings will be lost." << endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!FileName(bind_dir).isDirWritable()) {
|
if (!bind_dir.isDirWritable()) {
|
||||||
lyxerr << "LyX could not write to the user bind directory '"
|
lyxerr << "LyX could not write to the user bind directory '"
|
||||||
<< bind_dir << "'. All user-defined key bindings will be lost." << endl;
|
<< bind_dir << "'. All user-defined key bindings will be lost." << endl;
|
||||||
return;
|
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_bind_.write(user_bind_file.toFilesystemEncoding(), false, false);
|
||||||
user_unbind_.write(user_bind_file.toFilesystemEncoding(), true, true);
|
user_unbind_.write(user_bind_file.toFilesystemEncoding(), true, true);
|
||||||
// immediately apply the keybindings. Why this is not done before?
|
// immediately apply the keybindings. Why this is not done before?
|
||||||
|
Loading…
Reference in New Issue
Block a user