Skip to content

Commit

Permalink
Utils: Add a FilePath::isResourceFile function
Browse files Browse the repository at this point in the history
Change-Id: I281e91bc24f5c32a5d64c31e73b7fc2f31cbade2
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
  • Loading branch information
hjk committed Jan 26, 2024
1 parent bb7a50e commit 0d4b3b5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/libs/utils/filepath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,15 @@ bool FilePath::isRootPath() const
return *this == HostOsInfo::root();
}

bool FilePath::isResourceFile() const
{
if (scheme() == u"qrc")
return true;
if (needsDevice())
return false;
return pathView().startsWith(':');
}

QString FilePath::encodedHost() const
{
QString result = host().toString();
Expand Down
1 change: 1 addition & 0 deletions src/libs/utils/filepath.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ class QTCREATOR_UTILS_EXPORT FilePath
bool isSymLink() const;
bool hasHardLinks() const;
bool isRootPath() const;
bool isResourceFile() const;
bool isNewerThan(const QDateTime &timeStamp) const;
QDateTime lastModified() const;
QFile::Permissions permissions() const;
Expand Down

0 comments on commit 0d4b3b5

Please sign in to comment.