private static <T> T findNearestLocalWith(Path dir, String fileName, Function<Path, T> accept) {
		if (dir == null) {
			dir = getCwd();
		}
		Path root = Settings.getLocalRootDir();
		while (dir != null && !isSameFile(dir, root)) {
			Path file = dir.resolve(fileName);
			if (Files.isRegularFile(file) && Files.isReadable(file)) {
				T result = accept.apply(file);
				if (result != null) {
					return result;
				}
			}
			file = dir.resolve(Settings.JBANG_DOT_DIR).resolve(fileName);
			if (Files.isRegularFile(file) && Files.isReadable(file)) {
				T result = accept.apply(file);
				if (result != null) {
					return result;
				}
			}
			dir = dir.getParent();
		}
		return null;
	}
Determines the path to the JAR that contains the given class

@return An actual Path if it was found, or an empty path if it was not
src/main/java/dev/jbang/util/Util.java