From: André Pönitz Date: Tue, 6 Nov 2007 22:20:05 +0000 (+0000) Subject: simplification X-Git-Tag: 1.6.10~7445 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=a88884aaa279a0337ee68bd22ed71e78696bed7b;p=features.git simplification git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21483 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/BufferView.cpp b/src/BufferView.cpp index 51f856fbfe..f01b460b1d 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -74,15 +74,13 @@ #include "support/filetools.h" #include "support/Package.h" #include "support/types.h" -#include "support/fs_extras.h" -#include #include -#include #include #include #include +#include #include 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 = diff --git a/src/sgml.cpp b/src/sgml.cpp index 928e0eb09e..76e8ee0a4b 100644 --- a/src/sgml.cpp +++ b/src/sgml.cpp @@ -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)); diff --git a/src/support/fs_extras.cpp b/src/support/fs_extras.cpp index de2f272514..0a3dfe0084 100644 --- a/src/support/fs_extras.cpp +++ b/src/support/fs_extras.cpp @@ -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) { diff --git a/src/support/fs_extras.h b/src/support/fs_extras.h index 82dc4de5f1..cdb026735b 100644 --- a/src/support/fs_extras.h +++ b/src/support/fs_extras.h @@ -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); }