Utils: Introduce a FilePath::refersToExecutableFile

... to avoid the need in user code to care for .exe and .bat suffixes.

Change-Id: Ic249f14273f72c663912482555f98be1af923823
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2022-10-21 10:43:09 +02:00
committed by Christian Stenger
parent 9635b1545b
commit a333efe901
4 changed files with 68 additions and 3 deletions

View File

@@ -396,6 +396,16 @@ bool FilePath::isExecutableFile() const
return fileAccess()->isExecutableFile(*this);
}
/// \returns a bool indicating on whether a process with this FilePath's
/// .nativePath() is likely to start.
///
/// This is equivalent to \c isExecutableFile() in general.
/// On Windows, it will check appending various suffixes, too.
bool FilePath::refersToExecutableFile(MatchScope matchScope) const
{
return fileAccess()->refersToExecutableFile(*this, matchScope);
}
bool FilePath::isReadableFile() const
{
return fileAccess()->isReadableFile(*this);