Check the output path, searching for $1
if exist, returns the path remplacing $1 by file name

@param {String|Array} input - Path file
@param {String} output - Path to the output file
@return {Object}
481191
function checkOutput(input, output) {
  let reg = new RegExp('\\$1');
  if (reg.test(output)) {
    if (Array.isArray(input)) {
      const outputMin = input.map(file => {
        return utils.setFileNameMin(file, output);
      });
      return { output: outputMin };
    } else {
      return { output: utils.setFileNameMin(input, output) };
    }
  }
}
272559
function _parseInput (input, opts, cb) {
  if (isFileList(input)) input = Array.from(input)
  if (!Array.isArray(input)) input = [ input ]

  if (input.length === 0) throw new Error('invalid input type')

  input.forEach(item => {
    if (item == null) throw new Error(`invalid input type: ${item}`)
  })

  // In Electron, use the true file path
  input = input.map(item => {
    if (isBlob(item) && typeof item.path === 'string' && typeof fs.stat === 'function') return item.path
    return item
  })

  // If there's just one file, allow the name to be set by `opts.name`
  if (input.length === 1 && typeof input[0] !== 'string' && !input[0].name) input[0].name = opts.name

  let commonPrefix = null
  input.forEach((item, i) => {
    if (typeof item === 'string') {
      return
    }

    let path = item.fullPath || item.name
    if (!path) {
      path = `Unknown File ${i + 1}`
      item.unknownName = true
    }

    item.path = path.split('/')

    // Remove initial slash
    if (!item.path[0]) {
      item.path.shift()
    }

    if (item.path.length < 2) { // No real prefix
      commonPrefix = null
    } else if (i === 0 && input.length > 1) { // The first file has a prefix
      commonPrefix = item.path[0]
    } else if (item.path[0] !== commonPrefix) { // The prefix doesn't match
      commonPrefix = null
    }
  })

  // remove junk files
  input = input.filter(item => {
    if (typeof item === 'string') {
      return true
    }
    const filename = item.path[item.path.length - 1]
    return notHidden(filename) && junk.not(filename)
  })

  if (commonPrefix) {
    input.forEach(item => {
      const pathless = (Buffer.isBuffer(item) || isReadable(item)) && !item.path
      if (typeof item === 'string' || pathless) return
      item.path.shift()
    })
  }

  if (!opts.name && commonPrefix) {
    opts.name = commonPrefix
  }

  if (!opts.name) {
    // use first user-set file name
    input.some(item => {
      if (typeof item === 'string') {
        opts.name = corePath.basename(item)
        return true
      } else if (!item.unknownName) {
        opts.name = item.path[item.path.length - 1]
        return true
      }
    })
  }

  if (!opts.name) {
    opts.name = `Unnamed Torrent ${Date.now()}`
  }

  const numPaths = input.reduce((sum, item) => sum + Number(typeof item === 'string'), 0)

  let isSingleFileTorrent = (input.length === 1)

  if (input.length === 1 && typeof input[0] === 'string') {
    if (typeof fs.stat !== 'function') {
      throw new Error('filesystem paths do not work in the browser')
    }
    // If there's a single path, verify it's a file before deciding this is a single
    // file torrent
    isFile(input[0], (err, pathIsFile) => {
      if (err) return cb(err)
      isSingleFileTorrent = pathIsFile
      processInput()
    })
  } else {
    process.nextTick(() => {
      processInput()
    })
  }

  function processInput () {
    parallel(input.map(item => cb => {
      const file = {}

      if (isBlob(item)) {
        file.getStream = getBlobStream(item)
        file.length = item.size
      } else if (Buffer.isBuffer(item)) {
        file.getStream = getBufferStream(item)
        file.length = item.length
      } else if (isReadable(item)) {
        file.getStream = getStreamStream(item, file)
        file.length = 0
      } else if (typeof item === 'string') {
        if (typeof fs.stat !== 'function') {
          throw new Error('filesystem paths do not work in the browser')
        }
        const keepRoot = numPaths > 1 || isSingleFileTorrent
        getFiles(item, keepRoot, cb)
        return // early return!
      } else {
        throw new Error('invalid input type')
      }
      file.path = item.path
      cb(null, file)
    }), (err, files) => {
      if (err) return cb(err)
      files = flatten(files)
      cb(null, files, isSingleFileTorrent)
    })
  }
}
315917
function (files, output, name) {
    this.files = files;
    this.outputfile = path.resolve(output || os.tmpdir()) + path.sep + (name || '.check');
    this.data = {};
}
1064370
function(input) {
  var code = 'var $_parsers = {\n';
  var parsernames = Object.keys(parsers);
  for (var i = 0; i < parsernames.length; i++) {
    code += '  ' + JSON.stringify(parsernames[i]) + ': ' +
      parsers[parsernames[i]].toString() + ',\n';
  };
  code += '}\n';
  code += compile(input) + '\nif (typeof $_end === "function") {$_end();}';
  var script = new vm.Script(code, {timeout: 4 * 60 * 1000});
  var runner = function(scope) {
    var output = '';
    var pipeOpen = false;
    var ended = false;
    var stream = new Readable({
      encoding: 'utf8',
      read: function() {
        pipeOpen = true;
        if (ended && output === '') {
          pipeOpen = this.push(null);
        } else if (output !== '') {
          pipeOpen = this.push(output);
          output = '';
        }
      },
    });
    scope.$_scope = scope;
    scope.$_write = function(data) {
      output += '' + data;
      if (pipeOpen && output !== '') {
        pipeOpen = stream.push(output);
        output = '';
      }
    };
    scope.$_end = function() {
      ended = true;
      if (pipeOpen) { stream.push(null); }
    };
    script.runInNewContext(scope)
    return stream;
  };
  runner.code = code;
  return runner;
}
330359
def get_output_filename(args):
    """"""
    # If filename and path provided, use these for output text file.
    if args.directory is not None and args.fileprefix is not None:
        path = args.directory
        filename = args.fileprefix
        output = os.path.join(path, filename)
    # Otherwise, set output to current path
    elif args.fileprefix is not None:
        output = args.fileprefix
    else:
        output = args.pid
    return output
458961
function parent$1(object, path) {
  return path.length < 2 ? object : baseGet$2(object, baseSlice(path, 0, -1));
}
984698
def getinputfile(self, outputfile, loadmetadata=True, client=None,requiremetadata=False):
        """"""
        if isinstance(outputfile, CLAMOutputFile):
            outputfilename = str(outputfile).replace(os.path.join(self.projectpath,'output/'),'')
        else:
            outputfilename = outputfile
        if outputfilename not in self:
            raise KeyError("No such outputfile " + outputfilename)
        try:
            return next(self.getinputfiles(outputfile,loadmetadata,client,requiremetadata))
        except StopIteration:
            raise StopIteration("No input files for outputfile " + outputfilename)
1142272
def _preprocessContaminantOutFilePath(outPath):
        
        if '/' in outPath:
            splitPath = outPath.split('/')

        elif '\\' in outPath:
            splitPath = outPath.split('\\')

        else:
            splitPath = [outPath, ]

        if splitPath[-1] == '':
            outputFilename = splitPath[-2]

        else:
            outputFilename = splitPath[-1]

        if '.' in outputFilename:
            outputFilename = outputFilename.split('.')[0]

        return outputFilename
60541
function resolveFileToURL(output, filePath) {
    // Convert /test.png -> test.png
    filePath = LocationUtils.toAbsolute(filePath, '', '');

    var page = output.getPage(filePath);

    // if file is a page, return correct .html url
    if (page) {
        filePath = fileToURL(output, filePath);
    }

    return LocationUtils.normalize(filePath);
}
987802
def reduce_output_path(path=None, pdb_name=None):
    """"""
    if not path:
        if not pdb_name:
            raise NameError(
                "Cannot save an output for a temporary file without a PDB"
                "code specified")
        pdb_name = pdb_name.lower()
        output_path = Path(global_settings['structural_database']['path'],
                           pdb_name[1:3].lower(), pdb_name[:4].lower(),
                           'reduce', pdb_name + '_reduced.mmol')
    else:
        input_path = Path(path)
        if len(input_path.parents) > 1:
            output_path = input_path.parents[1] / 'reduce' / \
                (input_path.stem + '_reduced' + input_path.suffix)
        else:
            output_path = input_path.parent / \
                (input_path.stem + '_reduced' + input_path.suffix)
    return output_path
108290
function dirname(p){
  utils.assertString(p, 'path');
  return path.dirname(p.val).replace(/\\/g, '/');
}
890337
function getorigPath(filePath, base) {
    var extName = path.extname(filePath);
    var pt = path.resolve(base, filePath);
    if (!extName) pt += '.js';
    return pt;
}
695414
def _get_output_path(self):
        """"""
        if self.Parameters['-o'].isOn():
            output_path = self._absolute(str(self.Parameters['-o'].Value))
        else:
            raise ValueError("No output path specified.")
        return output_path
137691
function parse(input) {
				if (typeof input === 'object') {
					input = stringify(input);
				}

				if (!input) {
					return { m: 0 };
				}

				var path = input.split('-');
				output = {
					m: Number(path.shift())
				};

				if (path.length) {
					path.forEach(function (variation, i) {
						variation = variation.split(':');
						output[Number(variation[0])] = parseInt(variation[1], 10);
					});
				}

				return output;
			}
1252028
function dedot(path) { // eslint-disable-line complexity
  const inpath = `${ path }`;
  let outpath = '';
  const len = inpath.length;

  // Walk over segment by segment.
  // Accumulate output onto outpath.

  // i is the index past last sep considered.
  let i = 0;
  if (len && inpath[0] === sep) {
    outpath = sep;
    i = 1;
  }
  const rootLength = outpath.length;

  for (let nextSep; i < len; i = nextSep + 1) {
    nextSep = apply(indexOf, inpath, [ sep, i ]);
    if (nextSep < 0) {
      nextSep = len;
    }
    const segmentLen = nextSep - i;
    switch (segmentLen) {
      case 0:
        continue;
      case 1:
        if (inpath[i] === '.') {
          continue;
        }
        break;
      case 2:
        if (inpath[i] === '.' && inpath[i + 1] === '.') {
          const lastOutSep = apply(lastIndexOf, outpath, [ sep ]);
          outpath = apply(substring, outpath, [ 0, max(rootLength, lastOutSep) ]);
          continue;
        }
        break;
      default:
        break;
    }
    const segment = apply(substring, inpath, [ i, nextSep ]);
    outpath = outpath + (outpath.length > rootLength ? sep : '') + segment;
  }

  return outpath;
}
150872
private static boolean isOutFile(final File filePathName, final File inputMap) {
        final File relativePath = FileUtils.getRelativePath(inputMap.getAbsoluteFile(), filePathName.getAbsoluteFile());
        return !(relativePath.getPath().length() == 0 || !relativePath.getPath().startsWith(".."));
    }
97419
function getProductionPath(assetPath, flags) {
  var ext = path.extname(assetPath);
  var filename = assetPath.slice(0, assetPath.lastIndexOf(ext));
  var out = filename;
  if (_.contains(flags, 'min')) {
    out += '.min';
  }
  out += ext;
  if (_.contains(flags, 'gz')) {
    out += '.gz';
  }
  return out;
}