UNPKG

ern-api-gen

Version:

Electrode Native API generator

26 lines 1.16 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const FileRule_1 = require("./FileRule"); const FileSystems_1 = __importDefault(require("../../java/FileSystems")); const StringBuilder_1 = __importDefault(require("../../java/StringBuilder")); class DirectoryRule extends FileRule_1.FileRule { constructor(syntax, definition) { super(syntax, definition); const pattern = this.getPattern(); const sb = StringBuilder_1.default('glob:', pattern); if (!pattern.endsWith('/')) { sb.append('/'); } this.directoryMatcher = FileSystems_1.default.getDefault().getPathMatcher(sb.toString()); this.contentsMatcher = FileSystems_1.default.getDefault().getPathMatcher(sb.append('**').toString()); } matches(relativePath) { return (this.contentsMatcher.matches(relativePath) || this.directoryMatcher.matches(relativePath)); } } exports.DirectoryRule = DirectoryRule; //# sourceMappingURL=DirectoryRule.js.map