Fix MSVC/CMake error and display caught exception.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_5_X@21187 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-10-24 20:47:12 +00:00
parent 0d94d74b77
commit 3bb7b4153c

View File

@ -162,14 +162,17 @@ string const quoteName(string const & name, quote_style style)
bool isFileReadable(FileName const & filename)
{
std::string const path = filename.toFilesystemEncoding();
try {
// it seems that fs::exists can throw an exception
// when the file is not readable.
std::string const path = filename.toFilesystemEncoding();
return fs::exists(path)
&& !fs::is_directory(path)
&& fs::is_readable(path);
} catch (fs::filesystem_error const & fe){
lyxerr << "isFileReadable() error with path: "
<< path << endl;
lyxerr << fe.what() << endl;
return false;
}