forked from qt-creator/qt-creator
Utils: Don't complain about non-existing devices
FilePath::exists() does not need to warn if the device does not exist. Change-Id: I2ce6a5dec8806a8ee0a2f0e53a2c556c1d8c9e5b Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -455,30 +455,6 @@ void FilePath::setParts(const QStringView scheme, const QStringView host, QStrin
|
|||||||
m_pathLen = path.size();
|
m_pathLen = path.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns a bool indicating whether a file or directory with this FilePath exists.
|
|
||||||
*/
|
|
||||||
bool FilePath::exists() const
|
|
||||||
{
|
|
||||||
return fileAccess()->exists(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns a bool indicating whether this is a writable directory.
|
|
||||||
*/
|
|
||||||
bool FilePath::isWritableDir() const
|
|
||||||
{
|
|
||||||
return fileAccess()->isWritableDirectory(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns a bool indicating whether this is a writable file.
|
|
||||||
*/
|
|
||||||
bool FilePath::isWritableFile() const
|
|
||||||
{
|
|
||||||
return fileAccess()->isWritableFile(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Re-uses or creates a directory in this location.
|
\brief Re-uses or creates a directory in this location.
|
||||||
|
|
||||||
@@ -496,14 +472,6 @@ bool FilePath::ensureExistingFile() const
|
|||||||
return fileAccess()->ensureExistingFile(*this);
|
return fileAccess()->ensureExistingFile(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns a bool indicating whether this is an executable file.
|
|
||||||
*/
|
|
||||||
bool FilePath::isExecutableFile() const
|
|
||||||
{
|
|
||||||
return fileAccess()->isExecutableFile(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns a bool indicating on whether a process with this FilePath's
|
Returns a bool indicating on whether a process with this FilePath's
|
||||||
native path is likely to start.
|
native path is likely to start.
|
||||||
@@ -551,31 +519,6 @@ expected_str<FilePath> FilePath::createTempFile() const
|
|||||||
return fileAccess()->createTempFile(*this);
|
return fileAccess()->createTempFile(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FilePath::isReadableFile() const
|
|
||||||
{
|
|
||||||
return fileAccess()->isReadableFile(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool FilePath::isReadableDir() const
|
|
||||||
{
|
|
||||||
return fileAccess()->isReadableDirectory(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool FilePath::isFile() const
|
|
||||||
{
|
|
||||||
return fileAccess()->isFile(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool FilePath::isDir() const
|
|
||||||
{
|
|
||||||
return fileAccess()->isDirectory(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool FilePath::isSymLink() const
|
|
||||||
{
|
|
||||||
return fileAccess()->isSymLink(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool FilePath::hasHardLinks() const
|
bool FilePath::hasHardLinks() const
|
||||||
{
|
{
|
||||||
return fileAccess()->hasHardLinks(*this);
|
return fileAccess()->hasHardLinks(*this);
|
||||||
@@ -1217,6 +1160,100 @@ bool FilePath::hasFileAccess() const
|
|||||||
return access && access.value();
|
return access && access.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns a bool indicating whether a file or directory with this FilePath exists.
|
||||||
|
*/
|
||||||
|
bool FilePath::exists() const
|
||||||
|
{
|
||||||
|
const expected_str<DeviceFileAccess *> access = getFileAccess(*this);
|
||||||
|
if (!access)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return (*access)->exists(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns a bool indicating whether this is an executable file.
|
||||||
|
*/
|
||||||
|
bool FilePath::isExecutableFile() const
|
||||||
|
{
|
||||||
|
const expected_str<DeviceFileAccess *> access = getFileAccess(*this);
|
||||||
|
if (!access)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return (*access)->isExecutableFile(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns a bool indicating whether this is a writable directory.
|
||||||
|
*/
|
||||||
|
bool FilePath::isWritableDir() const
|
||||||
|
{
|
||||||
|
const expected_str<DeviceFileAccess *> access = getFileAccess(*this);
|
||||||
|
if (!access)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return (*access)->isWritableDirectory(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns a bool indicating whether this is a writable file.
|
||||||
|
*/
|
||||||
|
bool FilePath::isWritableFile() const
|
||||||
|
{
|
||||||
|
const expected_str<DeviceFileAccess *> access = getFileAccess(*this);
|
||||||
|
if (!access)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return (*access)->isWritableFile(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool FilePath::isReadableFile() const
|
||||||
|
{
|
||||||
|
const expected_str<DeviceFileAccess *> access = getFileAccess(*this);
|
||||||
|
if (!access)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return (*access)->isReadableFile(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FilePath::isReadableDir() const
|
||||||
|
{
|
||||||
|
const expected_str<DeviceFileAccess *> access = getFileAccess(*this);
|
||||||
|
if (!access)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return (*access)->isReadableDirectory(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FilePath::isFile() const
|
||||||
|
{
|
||||||
|
const expected_str<DeviceFileAccess *> access = getFileAccess(*this);
|
||||||
|
if (!access)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return (*access)->isFile(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FilePath::isDir() const
|
||||||
|
{
|
||||||
|
const expected_str<DeviceFileAccess *> access = getFileAccess(*this);
|
||||||
|
if (!access)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return (*access)->isDirectory(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FilePath::isSymLink() const
|
||||||
|
{
|
||||||
|
const expected_str<DeviceFileAccess *> access = getFileAccess(*this);
|
||||||
|
if (!access)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return (*access)->isSymLink(*this);
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Constructs a FilePath from \a filepath. The \a defaultExtension is appended
|
Constructs a FilePath from \a filepath. The \a defaultExtension is appended
|
||||||
to \a filepath if that does not have an extension already.
|
to \a filepath if that does not have an extension already.
|
||||||
|
|||||||
Reference in New Issue
Block a user