forked from qt-creator/qt-creator
Filepath: Add ensureReachable function
ensureReachable checks whether the device (if any) of the filepath can "reach" another FilePath. Devices can then either return false if they don't, or take action to ensure that the path can be reached. Change-Id: Ic1a315b9e7d9e37ee649989313a4cdb195a7e4d9 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -559,6 +559,18 @@ std::optional<QByteArray> FilePath::fileContents(qint64 maxSize, qint64 offset)
|
||||
return f.readAll();
|
||||
}
|
||||
|
||||
bool FilePath::ensureReachable(const FilePath &other) const
|
||||
{
|
||||
if (needsDevice()) {
|
||||
QTC_ASSERT(s_deviceHooks.ensureReachable, return false);
|
||||
return s_deviceHooks.ensureReachable(*this, other);
|
||||
} else if (!other.needsDevice()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void FilePath::asyncFileContents(const Continuation<const std::optional<QByteArray> &> &cont,
|
||||
qint64 maxSize,
|
||||
qint64 offset) const
|
||||
|
||||
Reference in New Issue
Block a user