Relative to the project root directory
10451
public function templatesDir(string $path): self
    {
        $this->validatePathIsRelativeToProject($path, __METHOD__);
        $this->templatesDir = rtrim($path, '/');

        return $this;
    }
630444
def DirectoriesRelative(self):
        
        # Acquire all directories
        directories = itertools.chain(self.Directories, (os.path.dirname(f) for f in itertools.chain(self.ContentFiles, self.CompileFiles)))
        directories = set(os.path.relpath(d, self.ProjectHome) for d in directories)

        # We need separate entries for parent directories of directories in the list
        for path in set(directories):
            subpath = os.path.dirname(path)
            while subpath:
                directories.add(subpath)
                subpath = os.path.dirname(subpath)

        return sorted(directories)
751074
def targets_relative_to_pwd(targets)
      targets.map do |t|
        if Pathname.new(t).absolute?
          Pathname.new(t).relative_path_from(Pathname.pwd)
        else
          t
        end
      end
    end
1303129
def parent_dir(path):
    ''''''
    return os.path.abspath(os.path.join(path, os.pardir, os.pardir, '_build'))
826391
function getFilePathRelativeToAppRoot (pPath) {
    // go to meow-blog directory
    var projectBaseDirectory = path.resolve(__dirname, '..');

    if (projectBaseDirectory.indexOf('node_modules') !== -1) {
        // from meow-blog, go up to node_modules, then go to base directory
        projectBaseDirectory = path.resolve(projectBaseDirectory, '..', '..');
    }

    return path.resolve(projectBaseDirectory, pPath);
}
258355
def context(root, project=""):
    

    environment = os.environ.copy()
    environment.update({
        "BE_PROJECT": project,
        "BE_PROJECTROOT": (
            os.path.join(root, project).replace("\\", "/")
            if project else ""),
        "BE_PROJECTSROOT": root,
        "BE_ALIASDIR": "",
        "BE_CWD": root,
        "BE_CD": "",
        "BE_ROOT": "",
        "BE_TOPICS": "",
        "BE_DEVELOPMENTDIR": "",
        "BE_ACTIVE": "1",
        "BE_USER": "",
        "BE_SCRIPT": "",
        "BE_PYTHON": "",
        "BE_ENTER": "",
        "BE_TEMPDIR": "",
        "BE_PRESETSDIR": "",
        "BE_GITHUB_API_TOKEN": "",
        "BE_ENVIRONMENT": "",
        "BE_BINDING": "",
        "BE_TABCOMPLETION": ""
    })

    return environment
198147
def project_dir(self) -> str:
        
        dev_dir = self.dev_dir()
        project = self.random.choice(PROJECT_NAMES)
        return str(self._pathlib_home / dev_dir / project)
726728
def inside_project?
      project_found = false
      cwd = Pathname(Dir.pwd)
      home_directory = File.expand_path('~')
      cwd.ascend do |current_path|
        project_found = File.file?("#{current_path.to_s}/.bebox")
        self.project_root = current_path.to_s if project_found
        break if project_found || (current_path.to_s == home_directory)
      end
      project_found
    end
342470
def format_path(path, project)
      full_path = (
        if Pathname.new(path).relative?
          File.join(project.full_path, path)
        else
          path
        end
      )
      Pathname.new(full_path).relative_path_from(Pathname.new(Dir.pwd))
    end
235710
function mkdirIfNotExists(relativePath) {
    const dir = path.join(__dirname, relativePath);
    let stat;
    try {
        stat = fs.statSync(dir);
    } catch (e) {
        fs.mkdirSync(dir);
    }
}
709319
function relative(path){
  var startX = 0
  var startY = 0
  var x = 0
  var y = 0

  return path.map(function(seg){
    seg = seg.slice()
    var type = seg[0]
    var command = type.toLowerCase()

    // is absolute
    if (type != command) {
      seg[0] = command
      switch (type) {
        case 'A':
          seg[6] -= x
          seg[7] -= y
          break
        case 'V':
          seg[1] -= y
          break
        case 'H':
          seg[1] -= x
          break
        default:
          for (var i = 1; i < seg.length;) {
            seg[i++] -= x
            seg[i++] -= y
          }
      }
    }

    // update cursor state
    switch (command) {
      case 'z':
        x = startX
        y = startY
        break
      case 'h':
        x += seg[1]
        break
      case 'v':
        y += seg[1]
        break
      case 'm':
        x += seg[1]
        y += seg[2]
        startX += seg[1]
        startY += seg[2]
        break
      default:
        x += seg[seg.length - 2]
        y += seg[seg.length - 1]
    }

    return seg
  })
}
299705
function cdProjectRoot(dir) {
    var projectRoot = this.isCordova(dir);
    if (!projectRoot) {
        throw new CordovaError('Current working directory is not a judpack project.');
    }
    if (!origCwd) {
        origCwd = process.env.PWD || process.cwd();
    }
    process.env.PWD = projectRoot;
    process.chdir(projectRoot);
    return projectRoot;
}
929638
def get_project_root():
    """"""
    cfg = get_project_configuration()
    # At this point it can be sure that the configuration file exists
    # Now make sure the project structure exists
    for dirname in ["raw-datasets",
                    "preprocessed",
                    "feature-files",
                    "models",
                    "reports"]:
        directory = os.path.join(cfg['root'], dirname)
        if not os.path.exists(directory):
            os.makedirs(directory)

    raw_yml_path = pkg_resources.resource_filename('hwrt', 'misc/')

    # TODO: How to check for updates if it already exists?
    raw_data_dst = os.path.join(cfg['root'], "raw-datasets/info.yml")
    if not os.path.isfile(raw_data_dst):
        raw_yml_pkg_src = os.path.join(raw_yml_path, "info.yml")
        shutil.copy(raw_yml_pkg_src, raw_data_dst)

    # Make sure small-baseline folders exists
    for dirname in ["models/small-baseline", "feature-files/small-baseline",
                    "preprocessed/small-baseline"]:
        directory = os.path.join(cfg['root'], dirname)
        if not os.path.exists(directory):
            os.makedirs(directory)

    # Make sure small-baseline yml files exist
    paths = [("preprocessed/small-baseline/", "preprocessing-small-info.yml"),
             ("feature-files/small-baseline/", "feature-small-info.yml"),
             ("models/small-baseline/", "model-small-info.yml")]
    for dest, src in paths:
        raw_data_dst = os.path.join(cfg['root'], "%s/info.yml" % dest)
        if not os.path.isfile(raw_data_dst):
            raw_yml_pkg_src = os.path.join(raw_yml_path, src)
            shutil.copy(raw_yml_pkg_src, raw_data_dst)

    return cfg['root']
960705
def base_dir(self):
        """"""
        if self.root_dir:
            return op.join(self.root_dir, self.id)
        else:
            return None
521953
def parse_relative_path(root_path, experiment_config, key):
    ''''''
    if experiment_config.get(key) and not os.path.isabs(experiment_config.get(key)):
        absolute_path = os.path.join(root_path, experiment_config.get(key))
        print_normal('expand %s: %s to %s ' % (key, experiment_config[key], absolute_path))
        experiment_config[key] = absolute_path
1218637
def include_dir(self, root):
        """"""
        parts = [root]
        parts.extend(self.pathname.split(os.path.sep))
        return "/".join(parts)
746932
def make_relative(base, obj):
    """"""
    uri = obj.get("location", obj.get("path"))
    if ":" in uri.split("/")[0] and not uri.startswith("file://"):
        pass
    else:
        if uri.startswith("file://"):
            uri = uri_file_path(uri)
            obj["location"] = os.path.relpath(uri, base)