diff options
Diffstat (limited to 'source/slang/slang-compiler.cpp')
| -rw-r--r-- | source/slang/slang-compiler.cpp | 67 |
1 files changed, 2 insertions, 65 deletions
diff --git a/source/slang/slang-compiler.cpp b/source/slang/slang-compiler.cpp index 497cf3d94..1a4a12dfe 100644 --- a/source/slang/slang-compiler.cpp +++ b/source/slang/slang-compiler.cpp @@ -24,6 +24,7 @@ #include "../compiler-core/slang-artifact-util.h" #include "../compiler-core/slang-artifact-associated.h" #include "../compiler-core/slang-artifact-diagnostic-util.h" +#include "../compiler-core/slang-artifact-container-util.h" // Artifact output #include "slang-artifact-output-util.h" @@ -1957,71 +1958,7 @@ namespace Slang { return SLANG_OK; } - - ComPtr<ISlangBlob> containerBlob; - SLANG_RETURN_ON_FAIL(m_containerArtifact->loadBlob(ArtifactKeep::Yes, containerBlob.writeRef())); - - { - FileStream stream; - SLANG_RETURN_ON_FAIL(stream.init(fileName, FileMode::Create, FileAccess::Write, FileShare::ReadWrite)); - SLANG_RETURN_ON_FAIL(stream.write(containerBlob->getBufferPointer(), containerBlob->getBufferSize())); - } - - auto parentPath = Path::getParentDirectory(fileName); - - // Lets look to see if we have any maps - { - Index nameCount = 0; - - for (auto associatedArtifact : m_containerArtifact->getAssociated()) - { - auto desc = associatedArtifact->getDesc(); - - if (isDerivedFrom(desc.payload, ArtifactPayload::SourceMap)) - { - StringBuilder artifactFilename; - - // Dump out - const char* artifactName = associatedArtifact->getName(); - if (artifactName && artifactName[0] != 0) - { - SLANG_RETURN_ON_FAIL(ArtifactUtil::calcName(associatedArtifact, UnownedStringSlice(artifactName), artifactFilename)); - } - else - { - // Perhaps we can generate the name from the output basename - StringBuilder baseName; - - baseName << Path::getFileNameWithoutExt(m_containerOutputPath); - - if (nameCount != 0) - { - baseName.appendChar('-'); - baseName.append(nameCount); - } - - SLANG_RETURN_ON_FAIL(ArtifactUtil::calcName(associatedArtifact, baseName.getUnownedSlice(), artifactFilename)); - - nameCount ++; - } - - ComPtr<ISlangBlob> blob; - SLANG_RETURN_ON_FAIL(associatedArtifact->loadBlob(ArtifactKeep::No, blob.writeRef())); - - // Try to write it out - { - // Work out the path to the artifact - auto artifactPath = Path::combine(parentPath, artifactFilename); - - // Write out the map - FileStream stream; - SLANG_RETURN_ON_FAIL(stream.init(artifactPath, FileMode::Create, FileAccess::Write, FileShare::ReadWrite)); - SLANG_RETURN_ON_FAIL(stream.write(blob->getBufferPointer(), blob->getBufferSize())); - } - } - } - } - + SLANG_RETURN_ON_FAIL(ArtifactContainerUtil::writeContainer(m_containerArtifact, fileName)); return SLANG_OK; } |
