mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-18 21:45:24 +00:00
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:
parent
0d94d74b77
commit
3bb7b4153c
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user