Minor tweaks.

This commit is contained in:
Pär Winzell 2019-08-07 09:32:45 -07:00 committed by GitHub
parent 10439bd40a
commit 5b6e876c33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 12 deletions

View File

@ -292,26 +292,26 @@ int main(int argc, char* argv[]) {
std::string modelPath; std::string modelPath;
const auto& suffix = FileUtils::GetFileSuffix(outputPath); const auto& suffix = FileUtils::GetFileSuffix(outputPath);
// set to binary output to true if extension is glb // Assume binary output if extension is glb
if (suffix.has_value() && suffix.value() == "glb") { if (suffix.has_value() && suffix.value() == "glb") {
gltfOptions.outputBinary = true; gltfOptions.outputBinary = true;
} }
if (gltfOptions.outputBinary) { if (gltfOptions.outputBinary) {
// add .glb to output path, unless it already ends in exactly that // add .glb to output path, unless it already ends in exactly that
if (suffix.has_value() && suffix.value() == "glb") { if (suffix.has_value() && suffix.value() == "glb") {
modelPath = outputPath;
} else {
modelPath = outputPath + ".glb";
}
// if the extension is gltf set the output folder to the parent directory
} else if(suffix.has_value() && suffix.value() == "gltf") {
modelPath = outputPath; modelPath = outputPath;
outputFolder = FileUtils::getFolder(outputPath) + "/"; } else {
modelPath = outputPath + ".glb";
}
// if the extension is gltf set the output folder to the parent directory
} else if (suffix.has_value() && suffix.value() == "gltf") {
outputFolder = FileUtils::getFolder(outputPath) + "/";
modelPath = outputPath;
} else { } else {
// in gltf mode, we create a folder and write into that // in gltf mode, we create a folder and write into that
outputFolder = fmt::format("{}_out/", outputPath.c_str()); outputFolder = fmt::format("{}_out/", outputPath.c_str());
modelPath = outputFolder + FileUtils::GetFileName(outputPath) + ".gltf"; modelPath = outputFolder + FileUtils::GetFileName(outputPath) + ".gltf";
} }
if (!FileUtils::CreatePath(modelPath.c_str())) { if (!FileUtils::CreatePath(modelPath.c_str())) {
fmt::fprintf(stderr, "ERROR: Failed to create folder: %s'\n", outputFolder.c_str()); fmt::fprintf(stderr, "ERROR: Failed to create folder: %s'\n", outputFolder.c_str());