obj2gltf/lib/outsideDirectory.js

18 lines
428 B
JavaScript
Raw Normal View History

'use strict';
2019-02-05 20:59:09 -05:00
const path = require('path');
module.exports = outsideDirectory;
/**
* Checks if a file is outside of a directory.
*
* @param {String} file Path to the file.
* @param {String} directory Path to the directory.
* @returns {Boolean} Whether the file is outside of the directory.
2017-12-28 14:34:30 -05:00
*
* @private
*/
function outsideDirectory(file, directory) {
return (path.relative(directory, file).indexOf('..') === 0);
}