Set output path to parent directory for gltf

If the output extension is gltf then set the output directory
to the parent. The binary and any associated textures will be written
to this directory.
This commit is contained in:
Jesse Vander Does 2019-05-12 15:36:22 -07:00
parent 0ba34ee7f5
commit c450ed53a1
1 changed files with 10 additions and 7 deletions

View File

@ -290,14 +290,17 @@ int main(int argc, char* argv[]) {
// the path of the actual .glb or .gltf file
std::string modelPath;
if (gltfOptions.outputBinary) {
const auto& suffix = FileUtils::GetFileSuffix(outputPath);
// add .glb to output path, unless it already ends in exactly that
if (suffix.has_value() && suffix.value() == "glb") {
const auto& suffix = FileUtils::GetFileSuffix(outputPath);
if (gltfOptions.outputBinary || suffix.value() == "glb") {
// add .glb to output path, unless it already ends in exactly that
if (suffix.has_value() && suffix.value() == "glb") {
modelPath = outputPath;
} else {
modelPath = outputPath + ".glb";
}
} else if(suffix.value() == "gltf") {
modelPath = outputPath;
} else {
modelPath = outputPath + ".glb";
}
outputFolder = FileUtils::getFolder(outputPath) + "/";
} else {
// in gltf mode, we create a folder and write into that
outputFolder = fmt::format("{}_out/", outputPath.c_str());