diff options
author | Jan Honsbrok <[email protected]> | 2025-05-20 15:33:13 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2025-05-20 15:33:13 +0200 |
commit | 4f3a759a0536c5b5bcd5c4312842f0adc3cb6218 (patch) | |
tree | 15e1ea68b170239d2c6a539008e28b5dcb6347d6 | |
parent | 3e8673b14d2a209852dd1a1633464fe03c31746d (diff) |
fix: missing OS separator in outfile (#6098)HEADupstream/master
The outfile was missing an OS separator when a PBRT file was exported in a path that was not the current directory.
Writing to /foo/bar.pbrt was writing to foobar.pbrt instead.
mPath and mFile are now handled like it's described in PbrtExporter.h
Co-authored-by: Kim Kulling <[email protected]>
-rw-r--r-- | code/Pbrt/PbrtExporter.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/code/Pbrt/PbrtExporter.cpp b/code/Pbrt/PbrtExporter.cpp index 05996494b..07bf1f056 100644 --- a/code/Pbrt/PbrtExporter.cpp +++ b/code/Pbrt/PbrtExporter.cpp @@ -93,7 +93,7 @@ void ExportScenePbrt(const char *pFile, IOSystem *pIOSystem, const aiScene *pSce const ExportProperties *) { std::string path = DefaultIOSystem::absolutePath(std::string(pFile)); std::string file = DefaultIOSystem::completeBaseName(std::string(pFile)); - path = path + file + ".pbrt"; + // initialize the exporter PbrtExporter exporter(pScene, pIOSystem, path, file); } @@ -174,7 +174,13 @@ PbrtExporter::PbrtExporter( WriteWorldDefinition(); // And write the file to disk... - std::unique_ptr<IOStream> outfile(mIOSystem->Open(mPath,"wt")); + std::string outputFilePath = mPath; + if (!outputFilePath.empty()) { + outputFilePath = outputFilePath + mIOSystem->getOsSeparator(); + } + outputFilePath = outputFilePath + mFile +".pbrt"; + + std::unique_ptr<IOStream> outfile(mIOSystem->Open(outputFilePath,"wt")); if (!outfile) { throw DeadlyExportError("could not open output .pbrt file: " + std::string(mFile)); } |