/* Conversion from files to paths methods
425013
private static Collection<Path> toPaths(Collection<File> files) {
		return Collections2.transform(files, FUNCTION_FILE_2_PATH);
	}
60745
function convertPaths(path) {
  var pathTemplate = new URITemplate(path).parse(), // must call parse to populate parts
    expressPath = '';

  _.forEach(pathTemplate.parts, function (part) {
    switch (typeof part) {
      case 'string':
        if (part.length > 0) {
          expressPath += part;
        }
        break;
      case 'object':
        if (part.expression.length > 0 && part.expression.match(PATH_REGEX)) {
          expressPath += ':' + _.first(part.variables).name;
        }
        break;
      default:
      // TODO throw error
    }
  });

  return expressPath;
}
423035
function make_find_path(FullPaths, Paths, FileIndex, files, root_name) {
	var UCFullPaths = new Array(FullPaths.length);
	var UCPaths = new Array(Paths.length), i;
	for(i = 0; i < FullPaths.length; ++i) UCFullPaths[i] = FullPaths[i].toUpperCase().replace(chr0,'').replace(chr1,'!');
	for(i = 0; i < Paths.length; ++i) UCPaths[i] = Paths[i].toUpperCase().replace(chr0,'').replace(chr1,'!');
	return function find_path(path) {
		var k;
		if(path.charCodeAt(0) === 47 /* "/" */) { k=true; path = root_name + path; }
		else k = path.indexOf("/") !== -1;
		var UCPath = path.toUpperCase().replace(chr0,'').replace(chr1,'!');
		var w = k === true ? UCFullPaths.indexOf(UCPath) : UCPaths.indexOf(UCPath);
		if(w === -1) return null;
		return k === true ? FileIndex[w] : files[Paths[w]];
	};
}
7851
function fixOutputPaths(output, files) {

    // map directories to use for index files
    var dirMap = {};
    u.each(files, function(file) {
      dirMap[ppath.dirname(file.path)] = true;

      // edge case - treat /foo/ as directory too
      if (/\/$/.test(file.path) && ppath.dirname(file.path) !== file.path) {
        dirMap[file.path] = true;
      }
    });

    // default output file extension is .html
    var extension = 'extension' in output ? (output.extension || '') : '.html';
    var indexFile = output.indexFile || 'index';

    u.each(files, function(file) {
      if (dirMap[file.path]) {
        debug('index file for %s', file.path);
        file.path = ppath.join(file.path, indexFile);
      }
      if (!/\.[^/]*$/.test(file.path)) {
        file.path = file.path + extension;
      }
    });
  }
87798
function extractPaths(obj, newKeys, ...paths) {
  const nkLen = newKeys.length;
  const pLen = paths.length;

  const curried = curry(assignKeysAtPaths, obj, newKeys, paths);

  return nkLen > pLen ? curried(nkLen) : curried(pLen);
}
1283778
function (output) {
              // Manually convert paths to relative, because LESS
              // can make tose absolute for complex cases.
              var map = JSON.parse(output);
              var dir = path.dirname(context.pathname);
              map.sources.forEach(function (file, idx) {
                var rel = path.relative(dir, file);
                if (path.sep === '\\') { rel = rel.replace('\\', '/'); }
                map.sources[idx] = rel;
              });

              self.map = JSON.stringify(map);
            }
713907
function ( srcs ) {
		return [
			/*
			 * Distribute foldernames and filenames in hashmaps.
			 */
			function step1 ( srcs ) {
				var map = Object.create ( null );
				function next ( source, parts, map ) {
					var part = parts.shift ();
					if ( !parts.length ) {
						map [ part ] = source;
					} else {
						map [ part ] = map [ part ] || Object.create ( null );
						next ( source, parts, map [ part ]);
					}
				}
				srcs.forEach ( function ( source ) {
					next ( source, source.split ( "/" ), map );
				});
				return map;
			},
			/*
			 * Transforming hashmaps into objects and arrays.
			 */
			function step2 ( map ) {
				var root = { name : "/", nodes : []};
				return ( function next ( map, parent, level ) {
					gui.Object.each ( map, function ( key, val ) {
						var node = { name : key };
						if ( typeof ( val ) === "object" ) {
							node.nodes = [];
							node.open = level < 1;
							next ( val, node, level + 1 );
						} else {
							node.src = val;
						}
						parent.nodes.push ( node );
					});
					return parent;
				}) ( map, root, 0 );
			},
			/*
			 * Split files from folders and sort them alphabetically.
			 */
			function step3 ( folder ) {
				var is, nodes = folder.nodes, alpha = function ( n1, n2 ) {
					return n1.name < n2.name ? -1 : n1.name > n2.name ? 1 : 0;
				};
				folder.nodes = nodes.filter ( function ( node ) {
					return (( is = node.nodes )) ? step3 ( node ) : false;
				}).sort ( alpha ).concat ( nodes.filter ( function ( node ) {
					return !node.nodes;
				}).sort ( alpha ));
				return folder;
			},
			/**
			 * Reduce to minimum viable root folder.
			 */
			function step4 ( folder ) {
				while ( folder.nodes.length === 1 && folder.nodes [ 0 ].nodes ) {
					//folder.hidden = true;
					folder = folder.nodes [ 0 ];
				}
				return folder;
			},
			/**
			 * Preoptimize search by stamping descendant filenames onto folders.
			 */
			function step5 ( folder ) {
				folder.filenames = folder.filenames || folder.nodes.map ( function ( node ) {
					return node.nodes ? step5 ( node ).filenames : node.name.toLowerCase ();
				}).join ( " " );
				return folder;
			}
		].reduce ( function ( input, nextstep ) { 
			return nextstep ( input ); 
		}, srcs );
	}
467013
private Set<String> getPaths(Map<String, String> params) {

        Set<String> result = Sets.newHashSet();
        String paths = params.get(CmsPublishOptions.PARAM_FILES);
        if (paths != null) {
            result.addAll(CmsStringUtil.splitAsList(paths, "|"));
        }
        return result;
    }
787217
function (dir, filelist, ext, currentBundleOptions) {
    var path = path || require('path');
    var fs = fs || require('fs');
    var files = fs.readdirSync(dir);
    filelist = filelist || [];
    files.forEach(function (file) {
        if (fs.statSync(path.join(dir, file)).isDirectory()) {
            filelist = walkSync(path.join(dir, file), filelist, ext, currentBundleOptions);
        }
        else {
            if (file.match(new RegExp("." + ext + "$")) && !isExcluded(file, currentBundleOptions))
                filelist.push(path.join(dir, file));
        }
    });
    return filelist;
}
1171585
function allPaths (splitPath, partialPath, finalPaths, i) {
  i = i || 0
  finalPaths = finalPaths || []
  partialPath = (partialPath || '') + splitPath[i]

  if (i >= splitPath.length - 1) {
    finalPaths.push(partialPath)
  } else {
    allPaths(splitPath, partialPath + '/', finalPaths, i + 1)
    allPaths(splitPath, partialPath + '\\', finalPaths, i + 1)
  }

  return finalPaths
}
823874
protected void initPaths() {
		// Hand-rolled String.join(), for java 6
		String[] split = getSplitDirPath();
		String[] obsolete = getObsoleteDirPath();

		//URLs are joined with '/'
		StringBuilder splitURL = new StringBuilder("/pub/pdb");
		for(int i=0;i<split.length;i++) {
			splitURL.append("/");
			splitURL.append(split[i]);
		}
		StringBuilder obsoleteURL = new StringBuilder("/pub/pdb");
		for(int i=0;i<obsolete.length;i++) {
			obsoleteURL.append("/");
			obsoleteURL.append(obsolete[i]);
		}

		splitDirURL = splitURL.toString();
		obsoleteDirURL = obsoleteURL.toString();


		//Files join themselves iteratively
		splitDirPath = path;
		for(int i=0;i<split.length;i++) {
			splitDirPath = new File(splitDirPath,split[i]);
		}
		obsoleteDirPath = path;
		for(int i=0;i<obsolete.length;i++) {
			obsoleteDirPath = new File(obsoleteDirPath,obsolete[i]);
		}
	}
1171719
function convert(files) {
    var converted = []
    files.forEach(function(file) {
      // We need originals as the destinations may not yet exist
      file = file.orig
      var dest = file.dest

      // Use destination for source if no source is available
      if (!file.src.length) {
        converted.push({
          src: dest,
          dest: dest
        })
        return
      }

      file.src.forEach(function(source) {
        converted.push({
          src: source,
          dest: dest
        })
      })
    })
    return converted
  }
1296058
function toAbsolute(files, options) {
  var len = files.length;
  var idx = -1;
  var arr = [];

  while (++idx < len) {
    var file = files[idx];
    if (!file.trim()) continue;
    if (file && options.cwd) {
      file = path.resolve(options.cwd, file);
    }
    if (file && options.realpath === true) {
      file = follow(file);
    }
    if (file) {
      arr.push(file);
    }
  }
  return arr;
}
501548
function setPathStaticFiles(array, filepath) {
    filepath = path.dirname(filepath);

    function setAbsoluteFilePath(file) {
      return filepath + '/' + file;
    }

    array = array.map(function (object) {
      if (_.isObject(object.request) && object.request.file) {
        if (!grunt.file.isPathAbsolute(object.request.file)) {
          object.request.file = setAbsoluteFilePath(object.request.file);
        }
      }
      if (_.isObject(object.response)) {
        // support collections for responses
        if (_.isArray(object.response)) {
          object.response = object.response.map(function (response) {
            if (response.file && !grunt.file.isPathAbsolute(response.file)) {
              response.file = setAbsoluteFilePath(response.file);
            }
            return response;
          });
        } else {
          if (object.response.file && !grunt.file.isPathAbsolute(object.response.file)) {
            object.response.file = setAbsoluteFilePath(object.response.file);
          }
        }
      }

      return object;
    });

    return array;
  }
94436
def _get_path_for(root, tlobject):
    """"""
    out_dir = root / ('methods' if tlobject.is_function else 'constructors')
    if tlobject.namespace:
        out_dir /= tlobject.namespace

    return out_dir / _get_file_name(tlobject)
1354318
function _filesToString (files, encoding, separator, callback) {

			if ("undefined" === typeof files) {
				throw new ReferenceError("missing \"files\" argument");
			}
				else if ("object" !== typeof files || !(files instanceof Array)) {
					throw new TypeError("\"files\" argument is not an Array");
				}
			else if ("undefined" === typeof callback && "undefined" === typeof separator && "undefined" === typeof encoding) {
				throw new ReferenceError("missing \"callback\" argument");
			}
				else if ("function" !== typeof callback && "function" !== typeof separator && "function" !== typeof encoding) {
					throw new TypeError("\"callback\" argument is not a function");
				}
			else {

				let _callback = callback;

				if ("undefined" === typeof _callback) {

					if ("undefined" === typeof separator) {
						_callback = encoding;
					}
					else {
						_callback = separator;
					}

				}

				filesToStreamProm(files, "string" === typeof separator ? separator : " ").then((readStream) => {

					return new Promise((resolve, reject) => {

						let data = "";
						let error = false;

						readStream.once("error", (_err) => {

							error = true;
							reject(_err);

						}).on("data", (chunk) => {
							data += chunk.toString("string" === typeof encoding ? encoding : "utf8");
						}).once("end", () => {

							if (!error) {
								resolve(data);
							}

						});

					});

				}).then((data) => {
					_callback(null, data);
				}).catch(_callback);

			}

		}
225899
private Path getPath(String fileName)
      throws IOException, URISyntaxException {
    Path path;
    URL url = getClass().getClassLoader().getResource(fileName);
    if (url == null) {
      throw new IOException(String.format("File %s is not existing", fileName));
    }
    URI uri = url.toURI();
    Map<String, String> env = new HashMap<>();
    if (uri.toString().contains("!")) {
      String[] parts = uri.toString().split("!");
      if (fs == null) {
        fs = FileSystems.newFileSystem(URI.create(parts[0]), env);
      }
      path = fs.getPath(parts[1]);
    } else {
      path = Paths.get(uri);
    }
    return path;
  }