diff options
Diffstat (limited to 'source/compiler-core/slang-artifact-representation-impl.cpp')
| -rw-r--r-- | source/compiler-core/slang-artifact-representation-impl.cpp | 60 |
1 files changed, 5 insertions, 55 deletions
diff --git a/source/compiler-core/slang-artifact-representation-impl.cpp b/source/compiler-core/slang-artifact-representation-impl.cpp index 20480ae07..d1de75c79 100644 --- a/source/compiler-core/slang-artifact-representation-impl.cpp +++ b/source/compiler-core/slang-artifact-representation-impl.cpp @@ -77,71 +77,21 @@ bool FileArtifactRepresentation::exists() return SLANG_SUCCEEDED(res) && pathType == SLANG_PATH_TYPE_FILE; } -FileArtifactRepresentation::~FileArtifactRepresentation() -{ - if (m_kind == Kind::Owned) - { - auto fileSystem = _getFileSystem(); - fileSystem->remove(m_path.getBuffer()); - } -} - -/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! LockFile !!!!!!!!!!!!!!!!!!!!!!!!!!! */ - -void* LockFile::getInterface(const Guid& guid) +void FileArtifactRepresentation::disown() { - if (guid == ISlangUnknown::getTypeGuid() || - guid == ICastable::getTypeGuid() || - guid == ILockFile::getTypeGuid()) + if (_isOwned()) { - return static_cast<ILockFile*>(this); + m_kind = Kind::Reference; } - return nullptr; -} - -void* LockFile::getObject(const Guid& guid) -{ - SLANG_UNUSED(guid); - return nullptr; } -ISlangMutableFileSystem* LockFile::_getFileSystem() -{ - return m_fileSystem ? m_fileSystem : OSFileSystem::getMutableSingleton(); -} - -void* LockFile::castAs(const Guid& guid) -{ - if (auto intf = getInterface(guid)) - { - return intf; - } - return getObject(guid); -} - -const char* LockFile::getPath() -{ - return (m_path.getLength() > 0) ? m_path.getBuffer() : nullptr; -} - -ISlangMutableFileSystem* LockFile::getFileSystem() -{ - return m_fileSystem; -} - -LockFile::~LockFile() +FileArtifactRepresentation::~FileArtifactRepresentation() { - if (m_path.getLength() > 0) + if (_isOwned()) { auto fileSystem = _getFileSystem(); fileSystem->remove(m_path.getBuffer()); } } -void LockFile::disown() -{ - m_path = String(); - m_fileSystem.setNull(); -} - } // namespace Slang |
