mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +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
|
||||
{
|
||||
LYXERR(Debug::FILES, "isDirWriteable: " << *this);
|
||||
FileName const tmpfl = FileName::tempName(absFilename() + "lyxwritetest");
|
||||
return !tmpfl.empty();
|
||||
LASSERT(d->fi.isDir(), return false);
|
||||
QFileInfo tmp(d->fi.absoluteDir(), "lyxwritetest");
|
||||
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