Utils: Add FilePath::isSymLink

Needed to fix GenericUploadStep handle the device->device case.

Change-Id: I551ac0957879e5b8737c22fa823d8b2e6bec0b5e
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
hjk
2022-10-14 10:11:13 +02:00
parent 2fd4be4603
commit 296538d23d
4 changed files with 28 additions and 0 deletions

View File

@@ -82,6 +82,13 @@ bool DeviceFileAccess::isDirectory(const FilePath &filePath) const
return false;
}
bool DeviceFileAccess::isSymLink(const FilePath &filePath) const
{
Q_UNUSED(filePath)
QTC_CHECK(false);
return false;
}
bool DeviceFileAccess::ensureWritableDirectory(const FilePath &filePath) const
{
if (isWritableDirectory(filePath))
@@ -317,6 +324,12 @@ bool DesktopDeviceFileAccess::isDirectory(const FilePath &filePath) const
return fi.isDir();
}
bool DesktopDeviceFileAccess::isSymLink(const FilePath &filePath) const
{
const QFileInfo fi(filePath.path());
return fi.isSymLink();
}
bool DesktopDeviceFileAccess::ensureWritableDirectory(const FilePath &filePath) const
{
const QFileInfo fi(filePath.path());
@@ -656,6 +669,12 @@ bool UnixDeviceFileAccess::isDirectory(const FilePath &filePath) const
return runInShellSuccess("test", {"-d", path});
}
bool UnixDeviceFileAccess::isSymLink(const FilePath &filePath) const
{
const QString path = filePath.path();
return runInShellSuccess("test", {"-h", path});
}
bool UnixDeviceFileAccess::ensureExistingFile(const FilePath &filePath) const
{
const QString path = filePath.path();