MCPcopy
hub / github.com/donmccurdy/glTF-Transform / checkKTXSoftware

Function checkKTXSoftware

packages/cli/src/transforms/toktx.ts:431–455  ·  view source on GitHub ↗
(logger: ILogger)

Source from the content-addressed store, hash-verified

429}
430
431export async function checkKTXSoftware(logger: ILogger): Promise<string> {
432 if (!(await commandExists(TrustedCommand.KTX)) && !process.env.CI) {
433 throw new Error(
434 `Command "ktx" not found. Please install KTX-Software ${KTX_SOFTWARE_VERSION_MIN}+, ` +
435 'from:\n\nhttps://github.com/KhronosGroup/KTX-Software',
436 );
437 }
438
439 const [status, stdout, stderr] = await waitExit(spawn('ktx', ['--version']));
440
441 const version = ((stdout || stderr) as string)
442 .replace(/ktx version:\s+/, '')
443 .replace(/~\d+/, '')
444 .trim();
445
446 if (status !== 0 || !version) {
447 throw new Error(
448 `Unable to find "ktx" version. Confirm KTX-Software ${KTX_SOFTWARE_VERSION_MIN}+ is installed.`,
449 );
450 } else {
451 logger.debug(`ktx: Found KTX-Software ${version}.`);
452 }
453
454 return version;
455}
456
457function isMultipleOfFour(value: number): boolean {
458 return value % 4 === 0;

Callers 2

ktxdecompressFunction · 0.85
toktxFunction · 0.85

Calls 1

debugMethod · 0.65

Tested by

no test coverage detected