]> git.lyx.org Git - lyx.git/blobdiff - src/lyx_cb.C
bug 2298: cursorTop/Bottom/Home/End does not redraw after dEPM
[lyx.git] / src / lyx_cb.C
index f13623ed6a9f29e4a945a87456327196301cb7f8..d69871edb723e2e0f879707fff0a3d05df4aba03 100644 (file)
 #include "frontends/LyXView.h"
 
 #include "support/filefilterlist.h"
-#include "support/FileInfo.h"
 #include "support/filetools.h"
 #include "support/forkedcall.h"
+#include "support/fs_extras.h"
 #include "support/lyxlib.h"
 #include "support/package.h"
 #include "support/path.h"
 #include "support/systemcall.h"
 
+#if !defined (HAVE_FORK)
+# define fork() -1
+#endif
+
 #include <boost/shared_ptr.hpp>
+#include <boost/filesystem/operations.hpp>
 
 #include <cerrno>
 #include <fstream>
@@ -53,7 +58,6 @@ using lyx::support::AddName;
 using lyx::support::bformat;
 using lyx::support::destroyDir;
 using lyx::support::FileFilterList;
-using lyx::support::FileInfo;
 using lyx::support::ForkedProcess;
 using lyx::support::IsLyXFilename;
 using lyx::support::LibFileSearch;
@@ -73,6 +77,8 @@ using lyx::support::unlink;
 
 using boost::shared_ptr;
 
+namespace fs = boost::filesystem;
+
 using std::back_inserter;
 using std::copy;
 using std::endl;
@@ -154,8 +160,7 @@ bool WriteAs(Buffer * buffer, string const & filename)
        } else
                fname = filename;
 
-       FileInfo const myfile(fname);
-       if (myfile.isOK()) {
+       if (fs::exists(fname)) {
                string const file = MakeDisplayPath(fname, 30);
                string text = bformat(_("The document %1$s already exists.\n\n"
                        "Do you want to over-write that document?"), file);
@@ -183,12 +188,12 @@ bool WriteAs(Buffer * buffer, string const & filename)
 }
 
 
-void QuitLyX()
+void QuitLyX(bool noask)
 {
        lyxerr[Debug::INFO] << "Running QuitLyX." << endl;
 
        if (lyx_gui::use_gui) {
-               if (!bufferlist.quitWriteAll())
+               if (!noask && !bufferlist.quitWriteAll())
                        return;
 
                LyX::cref().lastfiles().writeFile(lyxrc.lastfiles);
@@ -204,10 +209,11 @@ void QuitLyX()
        // do any other cleanup procedures now
        lyxerr[Debug::INFO] << "Deleting tmp dir " << package().temp_dir() << endl;
 
-       if (destroyDir(package().temp_dir()) != 0) {
-               string msg = bformat(_("Could not remove the temporary directory %1$s"),
+       if (!destroyDir(package().temp_dir())) {
+               string const msg =
+                       bformat(_("Unable to remove the temporary directory %1$s"),
                        package().temp_dir());
-               Alert::warning(_("Could not remove temporary directory"), msg);
+               Alert::warning(_("Unable to remove temporary directory"), msg);
        }
 
        lyx_gui::exit();
@@ -392,9 +398,7 @@ string getContentsOfAsciiFile(BufferView * bv, string const & f, bool asParagrap
                        return string();
        }
 
-       FileInfo fi(fname);
-
-       if (!fi.readable()) {
+       if (!fs::is_readable(fname)) {
                string const error = strerror(errno);
                string const file = MakeDisplayPath(fname, 50);
                string const text = bformat(_("Could not read the specified document\n"
@@ -443,8 +447,8 @@ void Reconfigure(BufferView * bv)
        // Run configure in user lyx directory
        Path p(package().user_support());
        string const configure_script =
-               AddName(package().system_support(), "configure");
-       string const configure_command = "sh " + QuoteName(configure_script);
+               AddName(package().system_support(), "configure.py");
+       string const configure_command = "python " + QuoteName(configure_script);
        Systemcall one;
        one.startscript(Systemcall::Wait, configure_command);
        p.pop();