mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-09 10:47:57 +00:00
use FileName::isDirectory()
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21047 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
055c95ca51
commit
988f372843
@ -771,8 +771,7 @@ namespace {
|
|||||||
|
|
||||||
bool insertIfExists(FileName const & absname, DepTable & head)
|
bool insertIfExists(FileName const & absname, DepTable & head)
|
||||||
{
|
{
|
||||||
if (absname.exists() &&
|
if (absname.exists() && !absname.isDirectory()) {
|
||||||
!fs::is_directory(absname.toFilesystemEncoding())) {
|
|
||||||
head.insert(absname, true);
|
head.insert(absname, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -851,8 +850,7 @@ bool handleFoundFile(string const & ff, DepTable & head)
|
|||||||
|
|
||||||
// (2) foundfile is in the tmpdir
|
// (2) foundfile is in the tmpdir
|
||||||
// insert it into head
|
// insert it into head
|
||||||
if (absname.exists() &&
|
if (absname.exists() && !absname.isDirectory()) {
|
||||||
!fs::is_directory(absname.toFilesystemEncoding())) {
|
|
||||||
// FIXME: This regex contained glo, but glo is used by the old
|
// FIXME: This regex contained glo, but glo is used by the old
|
||||||
// version of nomencl.sty. Do we need to put it back?
|
// version of nomencl.sty. Do we need to put it back?
|
||||||
static regex const unwanted("^.*\\.(aux|log|dvi|bbl|ind)$");
|
static regex const unwanted("^.*\\.(aux|log|dvi|bbl|ind)$");
|
||||||
|
39
src/LyX.cpp
39
src/LyX.cpp
@ -62,7 +62,6 @@
|
|||||||
#include "support/Systemcall.h"
|
#include "support/Systemcall.h"
|
||||||
|
|
||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
#include <boost/filesystem/operations.hpp>
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -84,8 +83,6 @@ using std::signal;
|
|||||||
using std::system;
|
using std::system;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace fs = boost::filesystem;
|
|
||||||
|
|
||||||
namespace lyx {
|
namespace lyx {
|
||||||
|
|
||||||
using support::addName;
|
using support::addName;
|
||||||
@ -985,8 +982,7 @@ bool LyX::init()
|
|||||||
prependEnvPath("PATH", lyxrc.path_prefix);
|
prependEnvPath("PATH", lyxrc.path_prefix);
|
||||||
|
|
||||||
FileName const document_path(lyxrc.document_path);
|
FileName const document_path(lyxrc.document_path);
|
||||||
if (document_path.exists() &&
|
if (document_path.exists() && document_path.isDirectory())
|
||||||
fs::is_directory(document_path.toFilesystemEncoding()))
|
|
||||||
package().document_dir() = document_path;
|
package().document_dir() = document_path;
|
||||||
|
|
||||||
package().temp_dir() = createLyXTmpDir(FileName(lyxrc.tempdir_path));
|
package().temp_dir() = createLyXTmpDir(FileName(lyxrc.tempdir_path));
|
||||||
@ -1114,38 +1110,32 @@ void LyX::deadKeyBindings(KeyMap * kbmap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
// return true if file does not exist or is older than configure.py.
|
// return true if file does not exist or is older than configure.py.
|
||||||
bool needsUpdate(string const & file)
|
static bool needsUpdate(string const & file)
|
||||||
{
|
{
|
||||||
// We cannot initialize configure_script directly because the package
|
// We cannot initialize configure_script directly because the package
|
||||||
// is not initialized yet when static objects are constructed.
|
// is not initialized yet when static objects are constructed.
|
||||||
static string configure_script;
|
static FileName configure_script;
|
||||||
static bool firstrun = true;
|
static bool firstrun = true;
|
||||||
if (firstrun) {
|
if (firstrun) {
|
||||||
configure_script = FileName(addName(
|
configure_script =
|
||||||
package().system_support().absFilename(),
|
FileName(addName(package().system_support().absFilename(),
|
||||||
"configure.py")).toFilesystemEncoding();
|
"configure.py"));
|
||||||
firstrun = false;
|
firstrun = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
string const absfile = FileName(addName(
|
FileName absfile =
|
||||||
package().user_support().absFilename(), file)).toFilesystemEncoding();
|
FileName(addName(package().user_support().absFilename(), file));
|
||||||
return (! fs::exists(absfile))
|
return !absfile.exists()
|
||||||
|| (fs::last_write_time(configure_script)
|
|| configure_script.lastModified() > absfile.lastModified();
|
||||||
> fs::last_write_time(absfile));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LyX::queryUserLyXDir(bool explicit_userdir)
|
bool LyX::queryUserLyXDir(bool explicit_userdir)
|
||||||
{
|
{
|
||||||
// Does user directory exist?
|
// Does user directory exist?
|
||||||
string const user_support =
|
FileName const sup = package().user_support();
|
||||||
package().user_support().toFilesystemEncoding();
|
if (sup.exists() && sup.isDirectory()) {
|
||||||
if (fs::exists(user_support) && fs::is_directory(user_support)) {
|
|
||||||
first_start = false;
|
first_start = false;
|
||||||
|
|
||||||
return needsUpdate("lyxrc.defaults")
|
return needsUpdate("lyxrc.defaults")
|
||||||
@ -1173,10 +1163,9 @@ bool LyX::queryUserLyXDir(bool explicit_userdir)
|
|||||||
}
|
}
|
||||||
|
|
||||||
lyxerr << to_utf8(bformat(_("LyX: Creating directory %1$s"),
|
lyxerr << to_utf8(bformat(_("LyX: Creating directory %1$s"),
|
||||||
from_utf8(package().user_support().absFilename())))
|
from_utf8(sup.absFilename()))) << endl;
|
||||||
<< endl;
|
|
||||||
|
|
||||||
if (!createDirectory(package().user_support(), 0755)) {
|
if (!createDirectory(sup, 0755)) {
|
||||||
// Failed, so let's exit.
|
// Failed, so let's exit.
|
||||||
lyxerr << to_utf8(_("Failed to create directory. Exiting."))
|
lyxerr << to_utf8(_("Failed to create directory. Exiting."))
|
||||||
<< endl;
|
<< endl;
|
||||||
|
@ -2077,7 +2077,7 @@ void LyXFunc::menuNew(string const & name, bool fromTemplate)
|
|||||||
filename = addName(lyxrc.document_path,
|
filename = addName(lyxrc.document_path,
|
||||||
"newfile" + convert<string>(++newfile_number) + ".lyx");
|
"newfile" + convert<string>(++newfile_number) + ".lyx");
|
||||||
while (theBufferList().exists(filename) ||
|
while (theBufferList().exists(filename) ||
|
||||||
fs::is_readable(FileName(filename).toFilesystemEncoding())) {
|
FileName(filename).isReadable()) {
|
||||||
++newfile_number;
|
++newfile_number;
|
||||||
filename = addName(lyxrc.document_path,
|
filename = addName(lyxrc.document_path,
|
||||||
"newfile" + convert<string>(newfile_number) +
|
"newfile" + convert<string>(newfile_number) +
|
||||||
@ -2403,9 +2403,8 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
|
|||||||
case LyXRC::RC_DISPLAY_GRAPHICS:
|
case LyXRC::RC_DISPLAY_GRAPHICS:
|
||||||
case LyXRC::RC_DOCUMENTPATH:
|
case LyXRC::RC_DOCUMENTPATH:
|
||||||
if (lyxrc_orig.document_path != lyxrc_new.document_path) {
|
if (lyxrc_orig.document_path != lyxrc_new.document_path) {
|
||||||
string const encoded = FileName(
|
FileName path(lyxrc_new.document_path);
|
||||||
lyxrc_new.document_path).toFilesystemEncoding();
|
if (path.exists() && path.isDirectory())
|
||||||
if (fs::exists(encoded) && fs::is_directory(encoded))
|
|
||||||
support::package().document_dir() = FileName(lyxrc.document_path);
|
support::package().document_dir() = FileName(lyxrc.document_path);
|
||||||
}
|
}
|
||||||
case LyXRC::RC_ESC_CHARS:
|
case LyXRC::RC_ESC_CHARS:
|
||||||
|
@ -16,8 +16,6 @@
|
|||||||
#include "support/Package.h"
|
#include "support/Package.h"
|
||||||
#include "support/filetools.h"
|
#include "support/filetools.h"
|
||||||
|
|
||||||
#include <boost/filesystem/operations.hpp>
|
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@ -28,8 +26,6 @@ using lyx::support::addName;
|
|||||||
using lyx::support::FileName;
|
using lyx::support::FileName;
|
||||||
using lyx::support::package;
|
using lyx::support::package;
|
||||||
|
|
||||||
namespace fs = boost::filesystem;
|
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using std::getline;
|
using std::getline;
|
||||||
using std::string;
|
using std::string;
|
||||||
@ -78,9 +74,8 @@ void LastFilesSection::read(istream & is)
|
|||||||
|
|
||||||
// read lastfiles
|
// read lastfiles
|
||||||
FileName const file(tmp);
|
FileName const file(tmp);
|
||||||
if (file.exists() &&
|
if (file.exists() && !file.isDirectory()
|
||||||
!fs::is_directory(file.toFilesystemEncoding()) &&
|
&& lastfiles.size() < num_lastfiles)
|
||||||
lastfiles.size() < num_lastfiles)
|
|
||||||
lastfiles.push_back(file);
|
lastfiles.push_back(file);
|
||||||
else
|
else
|
||||||
LYXERR(Debug::INIT) << "LyX: Warning: Ignore last file: " << tmp << endl;
|
LYXERR(Debug::INIT) << "LyX: Warning: Ignore last file: " << tmp << endl;
|
||||||
@ -133,8 +128,7 @@ void LastOpenedSection::read(istream & is)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
FileName const file(tmp);
|
FileName const file(tmp);
|
||||||
if (file.exists() &&
|
if (file.exists() && !file.isDirectory())
|
||||||
!fs::is_directory(file.toFilesystemEncoding()))
|
|
||||||
lastopened.push_back(file);
|
lastopened.push_back(file);
|
||||||
else
|
else
|
||||||
LYXERR(Debug::INIT) << "LyX: Warning: Ignore last opened file: " << tmp << endl;
|
LYXERR(Debug::INIT) << "LyX: Warning: Ignore last opened file: " << tmp << endl;
|
||||||
@ -188,9 +182,8 @@ void LastFilePosSection::read(istream & is)
|
|||||||
if (!absolutePath(fname))
|
if (!absolutePath(fname))
|
||||||
continue;
|
continue;
|
||||||
FileName const file(fname);
|
FileName const file(fname);
|
||||||
if (file.exists() &&
|
if (file.exists() && !file.isDirectory()
|
||||||
!fs::is_directory(file.toFilesystemEncoding()) &&
|
&& lastfilepos.size() < num_lastfilepos)
|
||||||
lastfilepos.size() < num_lastfilepos)
|
|
||||||
lastfilepos[file] = boost::tie(pit, pos);
|
lastfilepos[file] = boost::tie(pit, pos);
|
||||||
else
|
else
|
||||||
LYXERR(Debug::INIT) << "LyX: Warning: Ignore pos of last file: " << fname << endl;
|
LYXERR(Debug::INIT) << "LyX: Warning: Ignore pos of last file: " << fname << endl;
|
||||||
@ -269,9 +262,7 @@ void BookmarksSection::read(istream & is)
|
|||||||
continue;
|
continue;
|
||||||
FileName const file(fname);
|
FileName const file(fname);
|
||||||
// only load valid bookmarks
|
// only load valid bookmarks
|
||||||
if (file.exists() &&
|
if (file.exists() && !file.isDirectory() && idx <= max_bookmarks)
|
||||||
!fs::is_directory(file.toFilesystemEncoding()) &&
|
|
||||||
idx <= max_bookmarks)
|
|
||||||
bookmarks[idx] = Bookmark(file, pit, pos, 0, 0);
|
bookmarks[idx] = Bookmark(file, pit, pos, 0, 0);
|
||||||
else
|
else
|
||||||
LYXERR(Debug::INIT) << "LyX: Warning: Ignore bookmark of file: " << fname << endl;
|
LYXERR(Debug::INIT) << "LyX: Warning: Ignore bookmark of file: " << fname << endl;
|
||||||
|
@ -44,7 +44,6 @@
|
|||||||
#include "support/types.h"
|
#include "support/types.h"
|
||||||
|
|
||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
#include <boost/filesystem/operations.hpp>
|
|
||||||
|
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
@ -68,8 +67,6 @@ using std::make_pair;
|
|||||||
using std::pair;
|
using std::pair;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
||||||
namespace fs = boost::filesystem;
|
|
||||||
|
|
||||||
namespace lyx {
|
namespace lyx {
|
||||||
namespace frontend {
|
namespace frontend {
|
||||||
|
|
||||||
@ -765,8 +762,8 @@ docstring const GuiGraphics::browse(docstring const & in_name) const
|
|||||||
|
|
||||||
// Does user clipart directory exist?
|
// Does user clipart directory exist?
|
||||||
string clipdir = addName(package().user_support().absFilename(), "clipart");
|
string clipdir = addName(package().user_support().absFilename(), "clipart");
|
||||||
string const encoded_clipdir = FileName(clipdir).toFilesystemEncoding();
|
FileName clip(clipdir);
|
||||||
if (!(fs::exists(encoded_clipdir) && fs::is_directory(encoded_clipdir)))
|
if (!clip.exists() && clip.isDirectory())
|
||||||
// No - bail out to system clipart directory
|
// No - bail out to system clipart directory
|
||||||
clipdir = addName(package().system_support().absFilename(), "clipart");
|
clipdir = addName(package().system_support().absFilename(), "clipart");
|
||||||
pair<docstring, docstring> dir1(_("Clipart|#C#c"), from_utf8(clipdir));
|
pair<docstring, docstring> dir1(_("Clipart|#C#c"), from_utf8(clipdir));
|
||||||
|
@ -35,16 +35,12 @@
|
|||||||
#include "support/os.h"
|
#include "support/os.h"
|
||||||
#include "support/Package.h"
|
#include "support/Package.h"
|
||||||
|
|
||||||
#include <boost/filesystem/operations.hpp>
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
using std::endl;
|
using std::endl;
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
||||||
using boost::filesystem::is_directory;
|
|
||||||
|
|
||||||
|
|
||||||
namespace lyx {
|
namespace lyx {
|
||||||
|
|
||||||
@ -260,7 +256,7 @@ void updateExternal(InsetExternalParams const & params,
|
|||||||
FileName const temp_file(
|
FileName const temp_file(
|
||||||
support::makeAbsPath(params.filename.mangledFilename(),
|
support::makeAbsPath(params.filename.mangledFilename(),
|
||||||
m_buffer->temppath()));
|
m_buffer->temppath()));
|
||||||
if (!params.filename.empty() && !is_directory(params.filename.toFilesystemEncoding())) {
|
if (!params.filename.empty() && !params.filename.isDirectory()) {
|
||||||
unsigned long const from_checksum = support::sum(params.filename);
|
unsigned long const from_checksum = support::sum(params.filename);
|
||||||
unsigned long const temp_checksum = support::sum(temp_file);
|
unsigned long const temp_checksum = support::sum(temp_file);
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ bool FileName::exists() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool FileName::isDir() const
|
bool FileName::isDirectory() const
|
||||||
{
|
{
|
||||||
return QFileInfo(toqstr(name_)).isDir();
|
return QFileInfo(toqstr(name_)).isDir();
|
||||||
}
|
}
|
||||||
@ -100,6 +100,13 @@ bool FileName::isReadOnly() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool FileName::isReadable() const
|
||||||
|
{
|
||||||
|
QFileInfo const fi(toqstr(name_));
|
||||||
|
return fi.isReadable();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
std::time_t FileName::lastModified() const
|
std::time_t FileName::lastModified() const
|
||||||
{
|
{
|
||||||
return boost::filesystem::last_write_time(toFilesystemEncoding());
|
return boost::filesystem::last_write_time(toFilesystemEncoding());
|
||||||
|
@ -60,7 +60,9 @@ public:
|
|||||||
/// return true when file is readable but not writabel
|
/// return true when file is readable but not writabel
|
||||||
bool isReadOnly() const;
|
bool isReadOnly() const;
|
||||||
/// return true when it names a directory
|
/// return true when it names a directory
|
||||||
bool isDir() const;
|
bool isDirectory() const;
|
||||||
|
/// return true when file is readable
|
||||||
|
bool isReadable() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a FileName from \p name in the encoding used by the file system.
|
* Get a FileName from \p name in the encoding used by the file system.
|
||||||
|
@ -695,8 +695,7 @@ bool check_env_var_dir(FileName const & dir,
|
|||||||
bool check_env_var_dir(FileName const & dir,
|
bool check_env_var_dir(FileName const & dir,
|
||||||
string const & env_var)
|
string const & env_var)
|
||||||
{
|
{
|
||||||
string const encoded = dir.toFilesystemEncoding();
|
bool const success = dir.exists() && dir.isDirectory();
|
||||||
bool const success = (dir.exists() && fs::is_directory(encoded));
|
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
// Put this string on a single line so that the gettext
|
// Put this string on a single line so that the gettext
|
||||||
|
@ -224,8 +224,7 @@ vector<FileName> const dirList(FileName const & dir, string const & ext)
|
|||||||
// EXCEPTIONS FIXME. Rewrite needed when we turn on exceptions. (Lgb)
|
// EXCEPTIONS FIXME. Rewrite needed when we turn on exceptions. (Lgb)
|
||||||
vector<FileName> dirlist;
|
vector<FileName> dirlist;
|
||||||
|
|
||||||
string const encoded_dir = dir.toFilesystemEncoding();
|
if (!(dir.exists() && dir.isDirectory())) {
|
||||||
if (!(fs::exists(encoded_dir) && fs::is_directory(encoded_dir))) {
|
|
||||||
LYXERR(Debug::FILES)
|
LYXERR(Debug::FILES)
|
||||||
<< "Directory \"" << dir
|
<< "Directory \"" << dir
|
||||||
<< "\" does not exist to DirList." << endl;
|
<< "\" does not exist to DirList." << endl;
|
||||||
@ -237,6 +236,7 @@ vector<FileName> const dirList(FileName const & dir, string const & ext)
|
|||||||
extension += '.';
|
extension += '.';
|
||||||
extension += ext;
|
extension += ext;
|
||||||
|
|
||||||
|
string const encoded_dir = dir.toFilesystemEncoding();
|
||||||
fs::directory_iterator dit(encoded_dir);
|
fs::directory_iterator dit(encoded_dir);
|
||||||
fs::directory_iterator end;
|
fs::directory_iterator end;
|
||||||
for (; dit != end; ++dit) {
|
for (; dit != end; ++dit) {
|
||||||
@ -1224,23 +1224,20 @@ string const readBB_from_PSFile(FileName const & file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int compare_timestamps(FileName const & filename1, FileName const & filename2)
|
int compare_timestamps(FileName const & file1, FileName const & file2)
|
||||||
{
|
{
|
||||||
// If the original is newer than the copy, then copy the original
|
// If the original is newer than the copy, then copy the original
|
||||||
// to the new directory.
|
// to the new directory.
|
||||||
|
|
||||||
string const file1 = filename1.toFilesystemEncoding();
|
|
||||||
string const file2 = filename2.toFilesystemEncoding();
|
|
||||||
int cmp = 0;
|
int cmp = 0;
|
||||||
if (fs::exists(file1) && fs::exists(file2)) {
|
if (file1.exists() && file2.exists()) {
|
||||||
double const tmp = difftime(fs::last_write_time(file1),
|
double const tmp = difftime(file1.lastModified(), file2.lastModified());
|
||||||
fs::last_write_time(file2));
|
|
||||||
if (tmp != 0)
|
if (tmp != 0)
|
||||||
cmp = tmp > 0 ? 1 : -1;
|
cmp = tmp > 0 ? 1 : -1;
|
||||||
|
|
||||||
} else if (fs::exists(file1)) {
|
} else if (file1.exists()) {
|
||||||
cmp = 1;
|
cmp = 1;
|
||||||
} else if (fs::exists(file2)) {
|
} else if (file2.exists()) {
|
||||||
cmp = -1;
|
cmp = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,21 +11,16 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include "support/lyxlib.h"
|
#include "support/lyxlib.h"
|
||||||
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
#include "support/FileName.h"
|
#include "support/FileName.h"
|
||||||
|
|
||||||
#include <boost/crc.hpp>
|
#include <boost/crc.hpp>
|
||||||
#include <boost/filesystem/operations.hpp>
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
using std::endl;
|
using std::endl;
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
namespace fs = boost::filesystem;
|
|
||||||
|
|
||||||
// OK, this is ugly, but it is the only workaround I found to compile
|
// OK, this is ugly, but it is the only workaround I found to compile
|
||||||
// with gcc (any version) on a system which uses a non-GNU toolchain.
|
// with gcc (any version) on a system which uses a non-GNU toolchain.
|
||||||
// The problem is that gcc uses a weak symbol for a particular
|
// The problem is that gcc uses a weak symbol for a particular
|
||||||
@ -124,10 +119,10 @@ unsigned long sum(FileName const & file)
|
|||||||
LYXERR(Debug::FILES) << "lyx::sum() using istreambuf_iterator (fast)"
|
LYXERR(Debug::FILES) << "lyx::sum() using istreambuf_iterator (fast)"
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
string filename = file.toFilesystemEncoding();
|
|
||||||
// a directory may be passed here so we need to test it. (bug 3622)
|
// a directory may be passed here so we need to test it. (bug 3622)
|
||||||
if (fs::is_directory(filename))
|
if (file.isDirectory())
|
||||||
return 0;
|
return 0;
|
||||||
|
string filename = file.toFilesystemEncoding();
|
||||||
ifstream ifs(filename.c_str());
|
ifstream ifs(filename.c_str());
|
||||||
if (!ifs)
|
if (!ifs)
|
||||||
return 0;
|
return 0;
|
||||||
@ -148,10 +143,11 @@ unsigned long sum(FileName const & file)
|
|||||||
<< "lyx::sum() using istream_iterator (slow as a snail)"
|
<< "lyx::sum() using istream_iterator (slow as a snail)"
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
string filename = file.toFilesystemEncoding();
|
|
||||||
// a directory may be passed here so we need to test it. (bug 3622)
|
// a directory may be passed here so we need to test it. (bug 3622)
|
||||||
if (fs::is_directory(filename))
|
if (file.isDirectory())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
string filename = file.toFilesystemEncoding();
|
||||||
ifstream ifs(filename.c_str());
|
ifstream ifs(filename.c_str());
|
||||||
if (!ifs)
|
if (!ifs)
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user