mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 02:14:50 +00:00
FileName::isDirWritable(): make is safer.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25827 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
58303ecfa9
commit
68277d6e7f
@ -308,9 +308,15 @@ bool FileName::isWritable() const
|
|||||||
|
|
||||||
bool FileName::isDirWritable() const
|
bool FileName::isDirWritable() const
|
||||||
{
|
{
|
||||||
LYXERR(Debug::FILES, "isDirWriteable: " << *this);
|
LASSERT(d->fi.isDir(), return false);
|
||||||
FileName const tmpfl = FileName::tempName(absFilename() + "lyxwritetest");
|
QFileInfo tmp(d->fi.absoluteDir(), "lyxwritetest");
|
||||||
return !tmpfl.empty();
|
QTemporaryFile qt_tmp(tmp.absoluteFilePath());
|
||||||
|
if (qt_tmp.open()) {
|
||||||
|
LYXERR(Debug::FILES, "Directory " << *this << " is writable");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
LYXERR(Debug::FILES, "Directory " << *this << " is not writable");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user