The view-logic sub-path is the path on disk to the directory containing the requested
View and Logic files, relative to the base view-logic path.
962188
protected function getViewLogicSubPath(string $uriPath):string {
		$uriPath = str_replace(
			"/",
			DIRECTORY_SEPARATOR,
			$uriPath
		);
		$baseViewLogicPath = $this->getBaseViewLogicPath();
		$absolutePath = $baseViewLogicPath . $uriPath;

		$relativePath = substr($absolutePath, strlen($baseViewLogicPath));
		if(strlen($relativePath) > 1) {
			$relativePath = rtrim($relativePath, DIRECTORY_SEPARATOR);
		}
		return $relativePath;
	}
329193
function flattenPath(file, opts) {
  var fileName = path.basename(file.path);
  var dirs;

  if (!opts.includeParents && !opts.subPath) {
    return fileName;
  }

  dirs = path.dirname(file.relative).split(path.sep);
  if (opts.includeParents) {
    dirs = includeParents(dirs, opts.includeParents);
  }
  if (opts.subPath) {
    dirs = subPath(dirs, opts.subPath);
  }

  dirs.push(fileName);
  return path.join.apply(path, dirs);
}
548810
public function basepath()
    {
        $defaultPath = 'webroot{DS}files{DS}{model}{DS}{field}{DS}';
        $path = Hash::get($this->settings, 'path', $defaultPath);
        if (strpos($path, '{primaryKey}') !== false) {
            if ($this->entity->isNew()) {
                throw new LogicException('{primaryKey} substitution not allowed for new entities');
            }
            if (is_array($this->table->getPrimaryKey())) {
                throw new LogicException('{primaryKey} substitution not valid for composite primary keys');
            }
        }

        $replacements = [
            '{primaryKey}' => $this->entity->get($this->table->getPrimaryKey()),
            '{model}' => $this->table->getAlias(),
            '{table}' => $this->table->getTable(),
            '{field}' => $this->field,
            '{year}' => date("Y"),
            '{month}' => date("m"),
            '{day}' => date("d"),
            '{time}' => time(),
            '{microtime}' => microtime(true),
            '{DS}' => DIRECTORY_SEPARATOR,
        ];

        if (preg_match_all("/{field-value:(\w+)}/", $path, $matches)) {
            foreach ($matches[1] as $field) {
                $value = $this->entity->get($field);
                if ($value === null) {
                    throw new LogicException(sprintf('Field value for substitution is missing: %s', $field));
                } elseif (!is_scalar($value)) {
                    throw new LogicException(sprintf('Field value for substitution must be a integer, float, string or boolean: %s', $field));
                } elseif (strlen($value) < 1) {
                    throw new LogicException(sprintf('Field value for substitution must be non-zero in length: %s', $field));
                }

                $replacements[sprintf('{field-value:%s}', $field)] = $value;
            }
        }

        return str_replace(
            array_keys($replacements),
            array_values($replacements),
            $path
        );
    }
281264
def get_relative_file_path(absolute_file_path):
    '''
    
    '''
    global country_package_dir_path
    assert country_package_dir_path is not None
    relative_file_path = absolute_file_path[len(country_package_dir_path):]
    if relative_file_path.startswith('/'):
        relative_file_path = relative_file_path[1:]
    return relative_file_path
616729
function lookupFile(conf, fileRelative) {
  const relativeToFile = path.resolve(conf.filepath, fileRelative);
  if (layoutHelper.store.exist(relativeToFile)) {
    return relativeToFile;
  }

  if (conf.settings && conf.settings.views) {
    if (!Array.isArray(conf.settings.views)) {
      const fromView = path.resolve(conf.settings.views, fileRelative);
      if (layoutHelper.store.exist(fromView)) {
        return fromView;
      }
    }

    for (let i = 0; i < conf.settings.views.length; i += 1) {
      const fromView = path.resolve(conf.settings.views[i], fileRelative);
      if (layoutHelper.store.exist(fromView)) {
        return fromView;
      }
    }
  }

  return relativeToFile;
}
1166877
def subdir_path(directory, relative):
    """"""
    item_bits = directory.split(os.sep)
    relative_bits = relative.split(os.sep)
    for i, _item in enumerate(item_bits):
        if i == len(relative_bits) - 1:
            return os.sep.join(item_bits[i:])
        else:
            if item_bits[i] != relative_bits[i]:
                return None

    return None
593125
public static function createFromPath($path)
    {
        if (!is_dir($path) || !is_readable($path)) {
            throw new \LogicException(sprintf('%s does not exist or is not readable.', $path));
        }

        return static::createFromFilesystem(new Filesystem(new Local($path)));
    }
224628
function (subpath, f) {
    var args = Util.resolveArgs(arguments, '?subpath', 'f');
    update(this, args.subpath, args.f);
    return this;
  }
245895
public static Path subPath(Path path, int fromIndex, int toIndex) {
		if (null == path) {
			return null;
		}
		final int len = path.getNameCount();

		if (fromIndex < 0) {
			fromIndex = len + fromIndex;
			if (fromIndex < 0) {
				fromIndex = 0;
			}
		} else if (fromIndex > len) {
			fromIndex = len;
		}

		if (toIndex < 0) {
			toIndex = len + toIndex;
			if (toIndex < 0) {
				toIndex = len;
			}
		} else if (toIndex > len) {
			toIndex = len;
		}

		if (toIndex < fromIndex) {
			int tmp = fromIndex;
			fromIndex = toIndex;
			toIndex = tmp;
		}

		if (fromIndex == toIndex) {
			return null;
		}
		return path.subpath(fromIndex, toIndex);
	}
116555
function (subpath) {
    var subpathAsArray = asArrayPath(subpath);
    if (!Util.undefinedOrNull(this.get(subpathAsArray))) {
      update(this, subpathAsArray, clear);
    }
    return this;
  }
788722
def relative_path(path):
    
    return os.path.join(os.path.dirname(__file__), path)
459435
def _realpath(fs, path, seen=pset()):
    

    real = Path.root()
    for segment in path.segments:
        current = real / segment
        seen = seen.add(current)
        while True:
            try:
                current = fs.readlink(current)
            except (exceptions.FileNotFound, exceptions.NotASymlink):
                break
            else:
                current = current.relative_to(real)
                if current in seen:
                    raise exceptions.SymbolicLoop(path)
                current = fs.realpath(current, seen=seen)
        real = current
    return real
1094801
function (logicalPath) {
    if (this.assetMap[logicalPath]) {
      return [this.assetMap[logicalPath]];
    } else {
      if (this.serve && this.serve.individual) {
        var asset = this.smasher.getAssetByLogicalPath(logicalPath);
        if (asset) {
          return this.smasher.getRequiredLogicalPathsFor(asset);
        } else {
          return [logicalPath];
        }
      } else {
        return [logicalPath];
      }
    }
  }
1243393
public static <E> View<E> viewForPath(Dataset<E> dataset, Path path) {
    if (dataset instanceof FileSystemDataset) {
      return ((FileSystemDataset<E>) dataset).viewForUri(path.toUri());
    }
    throw new IllegalArgumentException("Not a file system dataset: " + dataset);
  }
301488
def _absolute_path(path, relative_to=None):
    '''
    
    '''

    if path and os.path.isabs(path):
        return path
    if path and relative_to is not None:
        _abspath = os.path.join(relative_to, path)
        if os.path.isfile(_abspath):
            log.debug(
                'Relative path \'%s\' converted to existing absolute path '
                '\'%s\'', path, _abspath
            )
            return _abspath
    return path
895086
def relative_path(self, filepath, basepath=None):
        
        if basepath is None:
            basepath = self.basedir
        if not basepath:
            return filepath
        if filepath.startswith(basepath):
            rel = filepath[len(basepath):]
        if rel and rel[0] == os.sep:
            rel = rel[1:]
        return rel
354033
def path(self):
        '''  '''
        if isinstance(self.dir, Directory):
            return self.dir._path
        elif isinstance(self.dir, ROOT.TDirectory):
            return self.dir.GetPath()
        elif isinstance(self.dir, _FolderView):
            return self.dir.path()
        else:
            return str(self.dir)