From c5851f49ea9c96a5482f555cdf2662073277c093 Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Sat, 31 Mar 2018 11:27:47 -0400 Subject: [PATCH] Use coerce instead --- bin/obj2gltf.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/bin/obj2gltf.js b/bin/obj2gltf.js index 3f9039d..82fc4e1 100644 --- a/bin/obj2gltf.js +++ b/bin/obj2gltf.js @@ -23,14 +23,24 @@ var argv = yargs alias : 'i', describe : 'Path to the obj file.', type : 'string', - normalize : true, - demandOption : true + demandOption : true, + coerce : function (p) { + if (p.length === 0) { + throw new Error('Input path must be a file name'); + } + return path.resolve(p); + } }, output : { alias : 'o', describe : 'Path of the converted glTF or glb file.', type : 'string', - normalize : true + coerce : function (p) { + if (p.length === 0) { + throw new Error('Output path must be a file name'); + } + return path.resolve(p); + } }, binary : { alias : 'b', @@ -128,16 +138,6 @@ if (defined(argv.metallicRoughnessOcclusionTexture) && defined(argv.specularGlos var objPath = argv.input; var gltfPath = argv.output; -if (objPath === '.') { - console.log('Input path is required'); - return; -} - -if (gltfPath === '.') { - console.log('Output path must be a filename'); - return; -} - var filename = defaultValue(gltfPath, objPath); var name = path.basename(filename, path.extname(filename)); var outputDirectory = path.dirname(filename);