#include "frontends/alert.h"
-#include <boost/filesystem/operations.hpp>
-
#include "support/filetools.h"
#include "support/convert.h"
#include "support/lyxlib.h"
namespace lyx {
-namespace fs = boost::filesystem;
namespace Alert = frontend::Alert;
using support::FileName;
// copy file
// need to make directory?
- string path = support::onlyPath(ext_file);
- if (!fs::is_directory(path))
- makedir(const_cast<char*>(path.c_str()), 0755);
+ FileName path = ext.onlyPath();
+ if (!path.isDirectory())
+ makedir(const_cast<char*>(path.absFilename().c_str()), 0755);
if (emb.copyTo(ext, false))
return true;
Alert::error(_("Copy file failure"),
}
// copy file
// need to make directory?
- string path = support::onlyPath(emb_file);
- if (!fs::is_directory(path))
- makedir(const_cast<char*>(path.c_str()), 0755);
+ FileName path = emb.onlyPath();
+ if (!path.isDirectory())
+ makedir(const_cast<char*>(path.absFilename().c_str()), 0755);
if (ext.copyTo(emb, false))
return true;
Alert::error(_("Copy file failure"),
#include "support/Systemcall.h"
#include "support/os.h"
-#include <boost/filesystem/operations.hpp>
-#include <boost/filesystem/path.hpp>
#include <boost/regex.hpp>
#include <fstream>
using support::trim;
namespace os = support::os;
-namespace fs = boost::filesystem;
// TODO: in no particular order
// - get rid of the call to
// memoir (at least) writes an empty *idx file in the first place.
// A second latex run is needed.
FileName const idxfile(changeExtension(file.absFilename(), ".idx"));
- rerun = idxfile.exists() && fs::is_empty(idxfile.toFilesystemEncoding());
+ rerun = idxfile.exists() && idxfile.isFileEmpty();
// run makeindex
if (head.haschanged(idxfile)) {
#include "support/filetools.h" // MakeAbsPath, MakeDisplayPath
-#include <boost/filesystem/operations.hpp>
-
#include <QLineEdit>
#include <QCheckBox>
#include <QListWidget>
Encoding const * const oldEnc = runparams.encoding;
runparams.encoding = &tmp->params().encoding();
tmp->makeLaTeXFile(writefile,
- masterFileName(buffer).onlyPath(),
+ masterFileName(buffer).onlyPath().absFilename(),
runparams, false);
runparams.encoding = oldEnc;
} else {
}
+bool FileName::isSymLink() const
+{
+ return QFileInfo(toqstr(name_)).isSymLink();
+}
+
+
+bool FileName::isFileEmpty() const
+{
+ return QFileInfo(toqstr(name_)).size() == 0;
+}
+
+
bool FileName::isDirectory() const
{
return QFileInfo(toqstr(name_)).isDir();
}
-std::string FileName::onlyPath() const
+FileName FileName::onlyPath() const
{
- return support::onlyPath(absFilename());
+ return FileName(support::onlyPath(absFilename()));
}
/// returns true if the file exists
bool exists() const;
+ /// \return true if this object points to a symbolic link.
+ bool isSymLink() const;
+ /// \return true if the file is empty.
+ bool isFileEmpty() const;
/// returns time of last write access
std::time_t lastModified() const;
/// return true when file is readable but not writabel
/// filename without path
std::string onlyFileName() const;
/// path without file name
- std::string onlyPath() const;
+ FileName onlyPath() const;
/// used for display in the Gui
docstring displayName(int threshold = 1000) const;
# include "support/os_win32.h"
#endif
-#include <boost/filesystem/operations.hpp>
#include <boost/tuple/tuple.hpp>
#include <list>
using std::string;
-namespace fs = boost::filesystem;
-
namespace lyx {
namespace support {
// Check whether binary is a symbolic link.
// If so, resolve it and repeat the exercise.
- if (!fs::symbolic_link_exists(binary.toFilesystemEncoding()))
+ if (!binary.isSymLink())
break;
FileName link;
FileName path(normalizePath(addPath(system_support_dir.absFilename(),
relative_locale_dir())));
- if (path.exists() && fs::is_directory(path.toFilesystemEncoding()))
+ if (path.exists() && path.isDirectory())
return path;
// 3. Fall back to the hard-coded LOCALEDIR.
path = hardcoded_localedir();
- if (path.exists() && fs::is_directory(path.toFilesystemEncoding()))
+ if (path.exists() && path.isDirectory())
return path;
return FileName();
// Check whether binary is a symbolic link.
// If so, resolve it and repeat the exercise.
- if (!fs::symbolic_link_exists(binary.toFilesystemEncoding()))
+ if (!binary.isSymLink())
break;
FileName link;
// This time test whether the directory is a symbolic link
// *before* looking for "chkconfig.ltx".
// (We've looked relative to the original already.)
- if (!fs::symbolic_link_exists(binary.toFilesystemEncoding()))
+ if (!binary.isSymLink())
break;
FileName link;