#include "frontends/Toolbars.h"
#include "support/filefilterlist.h"
-#include "support/FileInfo.h"
#include "support/filetools.h"
#include "support/forkedcontr.h"
+#include "support/fs_extras.h"
#include "support/lstrings.h"
#include "support/path.h"
#include "support/package.h"
#include "support/convert.h"
#include "support/os.h"
+#include <boost/filesystem/operations.hpp>
+
#include <sstream>
using bv_funcs::freefont2string;
+using lyx::support::AbsolutePath;
using lyx::support::AddName;
using lyx::support::AddPath;
using lyx::support::bformat;
using lyx::support::ChangeExtension;
using lyx::support::contains;
using lyx::support::FileFilterList;
-using lyx::support::FileInfo;
using lyx::support::FileSearch;
using lyx::support::ForkedcallsController;
using lyx::support::i18nLibFileSearch;
using lyx::support::QuoteName;
using lyx::support::rtrim;
using lyx::support::split;
-using lyx::support::strToInt;
-using lyx::support::strToUnsignedInt;
using lyx::support::subst;
using lyx::support::Systemcall;
using lyx::support::token;
using std::istringstream;
namespace biblio = lyx::biblio;
+namespace fs = boost::filesystem;
extern BufferList bufferlist;
else if (name == "print")
enable = Exporter::IsExportable(*buf, "dvi")
&& lyxrc.print_command != "none";
- else if (name == "character")
+ else if (name == "character" || name == "mathpanel")
enable = cur.inset().lyxCode() != InsetBase::ERT_CODE;
else if (name == "vclog")
enable = buf->lyxvc().inUse();
break;
}
+ case LFUN_DIALOG_SHOW_NEW_INSET:
+ enable = cur.inset().lyxCode() != InsetBase::ERT_CODE;
+ break;
+
case LFUN_DIALOG_UPDATE: {
string const name = cmd.getArg(0);
if (!buf)
case LFUN_NOTIFY:
case LFUN_GOTOFILEROW:
case LFUN_GOTO_PARAGRAPH:
- case LFUN_DIALOG_SHOW_NEW_INSET:
case LFUN_DIALOG_SHOW_NEXT_INSET:
case LFUN_DIALOG_HIDE:
case LFUN_DIALOG_DISCONNECT_INSET:
if (filename.empty()) {
filename = AddName(lyxrc.document_path,
"newfile" + convert<string>(++newfile_number) + ".lyx");
- FileInfo fi(filename);
- while (bufferlist.exists(filename) || fi.readable()) {
+ while (bufferlist.exists(filename) || fs::is_readable(filename)) {
++newfile_number;
filename = AddName(lyxrc.document_path,
"newfile" + convert<string>(newfile_number) +
".lyx");
- fi.newFile(filename);
}
}
string const disp_fn(MakeDisplayPath(filename));
// if the file doesn't exist, let the user create one
- FileInfo const f(filename, true);
- if (!f.exist()) {
+ if (!fs::exists(filename)) {
// the user specifically chose this name. Believe them.
view()->newFile(filename, "", true);
return;
// if the file exists already, and we didn't do
// -i lyx thefile.lyx, warn
- if (FileInfo(lyxfile, true).exist() && filename != lyxfile) {
+ if (fs::exists(lyxfile) && filename != lyxfile) {
string const file = MakeDisplayPath(lyxfile, 30);
string text = bformat(_("The document %1$s already exists.\n\n"
case LyXRC::RC_DISPLAY_GRAPHICS:
case LyXRC::RC_DOCUMENTPATH:
if (lyxrc_orig.document_path != lyxrc_new.document_path) {
- FileInfo fi(lyxrc_new.document_path);
- if (fi.isOK() && fi.isDir()) {
+ if (fs::exists(lyxrc_new.document_path) &&
+ fs::is_directory(lyxrc_new.document_path)) {
using lyx::support::package;
package().document_dir() = lyxrc.document_path;
}