forked from qt-creator/qt-creator
Utils: Fix remote ensureWritableDirectory
Previously ensureWritableDirectory would return true even if the directory existed but was not writable. This patch fixes that. Change-Id: I3c97ecb22eae7d77bf1d44b13b22d81ba2529062 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -117,6 +117,9 @@ bool DeviceFileAccess::ensureWritableDirectory(const FilePath &filePath) const
|
|||||||
{
|
{
|
||||||
if (isWritableDirectory(filePath))
|
if (isWritableDirectory(filePath))
|
||||||
return true;
|
return true;
|
||||||
|
if (exists(filePath))
|
||||||
|
return false;
|
||||||
|
|
||||||
return createDirectory(filePath);
|
return createDirectory(filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -518,6 +521,9 @@ bool DesktopDeviceFileAccess::ensureWritableDirectory(const FilePath &filePath)
|
|||||||
const QFileInfo fi(filePath.path());
|
const QFileInfo fi(filePath.path());
|
||||||
if (fi.isDir() && fi.isWritable())
|
if (fi.isDir() && fi.isWritable())
|
||||||
return true;
|
return true;
|
||||||
|
if (fi.exists())
|
||||||
|
return false;
|
||||||
|
|
||||||
return QDir().mkpath(filePath.path());
|
return QDir().mkpath(filePath.path());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user