-void quitLyX(bool noask)
-{
- lyxerr[Debug::INFO] << "Running QuitLyX." << endl;
-
- if (lyx_gui::use_gui) {
- if (!noask && !theApp->bufferList().quitWriteAll())
- return;
-
- LyX::cref().session().writeFile();
- }
-
- // Set a flag that we do quitting from the program,
- // so no refreshes are necessary.
- quitting = true;
-
- // close buffers first
- theApp->bufferList().closeAll();
-
- // do any other cleanup procedures now
- lyxerr[Debug::INFO] << "Deleting tmp dir " << package().temp_dir() << endl;
-
- if (!destroyDir(package().temp_dir())) {
- docstring const msg =
- bformat(_("Unable to remove the temporary directory %1$s"),
- lyx::from_utf8(package().temp_dir()));
- Alert::warning(_("Unable to remove temporary directory"), msg);
- }
-
- theApp->exit(0);
- // Restore original font resources after Application is destroyed.
- lyx::support::restoreFontResources();
-}
-
-