mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 02:14:50 +00:00
simplification
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21483 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
688c186614
commit
a88884aaa2
@ -74,15 +74,13 @@
|
||||
#include "support/filetools.h"
|
||||
#include "support/Package.h"
|
||||
#include "support/types.h"
|
||||
#include "support/fs_extras.h"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/current_function.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
|
||||
#include <cerrno>
|
||||
#include <fstream>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
#include <vector>
|
||||
|
||||
using std::distance;
|
||||
@ -97,8 +95,6 @@ using std::mem_fun_ref;
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
namespace lyx {
|
||||
|
||||
using support::addPath;
|
||||
@ -2062,7 +2058,7 @@ docstring BufferView::contentsOfPlaintextFile(string const & f,
|
||||
return docstring();
|
||||
}
|
||||
|
||||
if (!fs::is_readable(fname.toFilesystemEncoding())) {
|
||||
if (!fname.isReadable()) {
|
||||
docstring const error = from_ascii(strerror(errno));
|
||||
docstring const file = makeDisplayPath(fname.absFilename(), 50);
|
||||
docstring const text =
|
||||
|
@ -212,7 +212,7 @@ void sgml::openTag(Buffer const & buf, odocstream & os,
|
||||
string id = par.getID(buf, runparams);
|
||||
|
||||
string attribute;
|
||||
if(!id.empty()) {
|
||||
if (!id.empty()) {
|
||||
if (param.find('#') != string::npos) {
|
||||
string::size_type pos = param.find("id=<");
|
||||
string::size_type end = param.find(">");
|
||||
@ -223,7 +223,7 @@ void sgml::openTag(Buffer const & buf, odocstream & os,
|
||||
} else {
|
||||
if (param.find('#') != string::npos) {
|
||||
// FIXME UNICODE
|
||||
if(!style->counter.empty())
|
||||
if (!style->counter.empty())
|
||||
counters.step(style->counter);
|
||||
else
|
||||
counters.step(from_ascii(name));
|
||||
|
@ -46,50 +46,6 @@ namespace fs = boost::filesystem;
|
||||
namespace boost {
|
||||
namespace filesystem {
|
||||
|
||||
bool is_readable(path const & ph)
|
||||
{
|
||||
#ifdef BOOST_POSIX
|
||||
return ::access(ph.string().c_str(), R_OK) == 0;
|
||||
#endif
|
||||
#ifdef BOOST_WINDOWS
|
||||
DWORD const attr = ::GetFileAttributes(ph.string().c_str());
|
||||
return attr != INVALID_FILE_ATTRIBUTES &&
|
||||
(attr & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
bool is_writable(path const & ph)
|
||||
{
|
||||
#ifdef BOOST_POSIX
|
||||
return ::access(ph.string().c_str(), W_OK) == 0;
|
||||
#endif
|
||||
#ifdef BOOST_WINDOWS
|
||||
DWORD const attr = ::GetFileAttributes(ph.string().c_str());
|
||||
if (attr != INVALID_FILE_ATTRIBUTES &&
|
||||
(attr & FILE_ATTRIBUTE_READONLY) != 0) {
|
||||
// Read-only - no write access
|
||||
return false;
|
||||
}
|
||||
return attr != INVALID_FILE_ATTRIBUTES &&
|
||||
(attr & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
bool is_readonly(path const & ph)
|
||||
{
|
||||
#ifdef BOOST_POSIX
|
||||
return is_readable(ph) && !is_writable(ph);
|
||||
#endif
|
||||
#ifdef BOOST_WINDOWS
|
||||
DWORD const attr = ::GetFileAttributes(ph.string().c_str());
|
||||
return (attr != INVALID_FILE_ATTRIBUTES
|
||||
&& (attr & FILE_ATTRIBUTE_READONLY));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void copy_file(path const & source, path const & target, bool noclobber)
|
||||
{
|
||||
|
||||
|
@ -14,12 +14,6 @@
|
||||
namespace boost {
|
||||
namespace filesystem {
|
||||
|
||||
bool is_readable(path const & ph);
|
||||
|
||||
bool is_writable(path const & ph);
|
||||
|
||||
bool is_readonly(path const & ph);
|
||||
|
||||
void copy_file(path const & source, path const & target, bool noclobber);
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user