summaryrefslogtreecommitdiffstats
path: root/source/compiler-core/slang-artifact-representation-impl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/compiler-core/slang-artifact-representation-impl.cpp')
-rw-r--r--source/compiler-core/slang-artifact-representation-impl.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/source/compiler-core/slang-artifact-representation-impl.cpp b/source/compiler-core/slang-artifact-representation-impl.cpp
index 3fae154bb..105402e6e 100644
--- a/source/compiler-core/slang-artifact-representation-impl.cpp
+++ b/source/compiler-core/slang-artifact-representation-impl.cpp
@@ -67,6 +67,21 @@ bool ExtFileArtifactRepresentation::exists()
return SLANG_SUCCEEDED(res) && pathType == getPathType();
}
+const char* ExtFileArtifactRepresentation::getUniqueIdentity()
+{
+ if (m_uniqueIdentity.getLength() == 0)
+ {
+ ComPtr<ISlangBlob> uniqueIdentityBlob;
+ if (SLANG_FAILED(m_fileSystem->getFileUniqueIdentity(m_path.getBuffer(), uniqueIdentityBlob.writeRef())))
+ {
+ return nullptr;
+ }
+ m_uniqueIdentity = StringUtil::getString(uniqueIdentityBlob);
+ }
+
+ return m_uniqueIdentity.getLength() ? m_uniqueIdentity.getBuffer() : nullptr;
+}
+
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! SourceBlobWithPathArtifactRepresentation !!!!!!!!!!!!!!!!!!!!!!!!!!! */
void* SourceBlobWithPathInfoArtifactRepresentation::getInterface(const Guid& guid)
@@ -187,6 +202,23 @@ bool OSFileArtifactRepresentation::exists()
return SLANG_SUCCEEDED(res) && pathType == SLANG_PATH_TYPE_FILE;
}
+const char* OSFileArtifactRepresentation::getUniqueIdentity()
+{
+ if (m_uniqueIdentity.getLength() == 0)
+ {
+ auto fileSystem = _getFileSystem();
+
+ ComPtr<ISlangBlob> uniqueIdentityBlob;
+ if (SLANG_FAILED(fileSystem->getFileUniqueIdentity(m_path.getBuffer(), uniqueIdentityBlob.writeRef())))
+ {
+ return nullptr;
+ }
+ m_uniqueIdentity = StringUtil::getString(uniqueIdentityBlob);
+ }
+
+ return m_uniqueIdentity.getLength() ? m_uniqueIdentity.getBuffer() : nullptr;
+}
+
void OSFileArtifactRepresentation::disown()
{
if (_isOwned())