Returns the :attr:`StartupFile` relative to :attr:`ProjectHome` directory.
768279
def StartupFileRelative(self):
        
        return os.path.relpath(self.StartupFile, self.ProjectHome) if self.StartupFile else self.StartupFile
227585
function findProjectRoot(currentPath) {
  var result = undefined;

  try {
    var packageStats = lstatSync(path.join(currentPath, 'package.json'));

    if (packageStats.isFile()) {
      result = currentPath;
    }
  } catch (error) {
    if (currentPath !== path.resolve('/')) {
      result = findProjectRoot(path.join(currentPath, '..'));
    }
  }

  return result;
}
61001
def find_home
      ['HOME', 'USERPROFILE'].each {|e| return ENV[e] if ENV[e] }
      return "#{ENV['HOMEDRIVE']}#{ENV['HOMEPATH']}" if ENV['HOMEDRIVE'] && ENV['HOMEPATH']
      File.expand_path("~")
    rescue
      File::ALT_SEPARATOR ? "C:/" : "/"
    end
203981
def default_hass_config_dir():
    """"""
    data_dir = os.getenv("APPDATA") if os.name == "nt" else os.path.expanduser("~")
    return os.path.join(data_dir, ".homeassistant")
1361651
public static function getProjectRootDirectory(): string
    {
        if (null === self::$projectRootDirectory) {
            $reflection                 = new \ReflectionClass(ClassLoader::class);
            self::$projectRootDirectory = \dirname((string)$reflection->getFileName(), 3);
        }

        return self::$projectRootDirectory;
    }
902442
def bootstrap():  # pragma: no cover
    """"""

    # get a handle of the currently executing zip file
    archive = current_zipfile()

    # create an environment object (a combination of env vars and json metadata)
    env = Environment.from_json(archive.read("environment.json").decode())

    # get a site-packages directory (from env var or via build id)
    site_packages = cache_path(archive, env.root, env.build_id) / "site-packages"

    # determine if first run or forcing extract
    if not site_packages.exists() or env.force_extract:
        extract_site_packages(archive, site_packages.parent, env.compile_pyc, env.compile_workers, env.force_extract)

    # get sys.path's length
    length = len(sys.path)

    # Find the first instance of an existing site-packages on sys.path
    index = _first_sitedir_index() or length

    # append site-packages using the stdlib blessed way of extending path
    # so as to handle .pth files correctly
    site.addsitedir(site_packages)

    # add our site-packages to the environment, if requested
    if env.extend_pythonpath:
        _extend_python_path(os.environ, sys.path[index:])

    # reorder to place our site-packages before any others found
    sys.path = sys.path[:index] + sys.path[length:] + sys.path[index:length]

    # first check if we should drop into interactive mode
    if not env.interpreter:

        # do entry point import and call
        if env.entry_point is not None:
            mod = import_string(env.entry_point)
            try:
                sys.exit(mod())
            except TypeError:
                # catch "<module> is not callable", which is thrown when the entry point's
                # callable shares a name with it's parent module
                # e.g. "from foo.bar import bar; bar()"
                sys.exit(getattr(mod, env.entry_point.replace(":", ".").split(".")[1])())

        elif env.script is not None:
            sys.exit(runpy.run_path(site_packages / "bin" / env.script, run_name="__main__"))

    # all other options exhausted, drop into interactive mode
    execute_interpreter()
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)
537833
public static Resource getHomeDirectory() {
	if (homeFile != null) return homeFile;

	ResourceProvider frp = ResourcesImpl.getFileResourceProvider();

	String homeStr = System.getProperty("user.home");
	if (homeStr != null) {
	    homeFile = frp.getResource(homeStr);
	    homeFile = ResourceUtil.getCanonicalResourceEL(homeFile);
	}
	return homeFile;
    }
826617
function getHomePath () {
  if (process.platform === 'win32') {
    return process.env.USERPROFILE || process.env.HOMEDRIVE + process.env.HOMEPATH || process.env.HOME
  } else {
    return process.env.HOME
  }
}
1295197
def startup():
    
    model.setup()
    index.scan_index(config.content_folder)
    index.background_scan(config.content_folder)
371849
def startproject(project_name):
    
    # the destination path
    dst_path = os.path.join(os.getcwd(), project_name)
    start_init_info(dst_path)

    # create dst path
    _mkdir_p(dst_path)

    # create project tree
    os.chdir(dst_path)
    # create files
    init_code('manage.py', _manage_admin_code)
    init_code('requirement.txt', _requirement_admin_code)
    init_code('config.py', _config_sql_code)

    # create app/
    app_path = os.path.join(dst_path, 'app')
    _mkdir_p(app_path)

    # create files
    os.chdir(app_path)
    init_code('models.py', _models_admin_code)
    init_code('__init__.py', _init_admin_code)

    # create templates and static
    css_path, templates_path = create_templates_static_files(app_path)
    # create css files
    os.chdir(css_path)
    init_code('sign.css', _auth_login_css_code)

    # create main blueprint
    create_blueprint(
        app_path,
        'main',
        _views_blueprint_code % ('main', 'main'),
        _forms_basic_code,
        templates_path
    )

    # create auth blueprint
    auth_templates_path = create_blueprint(
        app_path,
        'auth',
        _auth_views_code,
        _auth_forms_code,
        templates_path
    )
    # create auth templates files
    os.chdir(auth_templates_path)
    init_code('login.html', _auth_login_html_code)

    # create admin site
    admin_path = os.path.join(app_path, 'admin')
    _mkdir_p(admin_path)

    # create admin files
    os.chdir(admin_path)
    init_code('__init__.py', '')
    init_code('views.py', _admin_views_code)

    # create admin templates
    os.chdir(templates_path)
    admin_templates_path = os.path.join(templates_path, 'admin')
    _mkdir_p(admin_templates_path)

    # create admin templates files
    os.chdir(admin_templates_path)
    init_code('index.html', _admin_index_html_code)
    init_code('logout.html', _admin_logout_html_code)

    init_done_info()
948735
def project_local_dir(self):
        

        # depending on where we are in bootstrapping the BaseGlobalConfig
        # the canonical projectname could be located in one of two places
        if self.project__name:
            name = self.project__name
        else:
            name = self.config_project.get("project", {}).get("name", "")
        if name is None:
            name = (
                ""
            )  # not entirely sure why this was happening in tests but this is the goal...

        path = os.path.join(
            os.path.expanduser("~"), self.global_config_obj.config_local_dir, name
        )
        if not os.path.isdir(path):
            os.makedirs(path)
        return path
1246184
def get_home_dir(long_name, service_name)
      # entry point
      url = "#{@client.app_info[:launcher_server]}#{API_VERSION}/dns/#{SafeNet.escape(service_name)}/#{SafeNet.escape(long_name)}"

      # api call
      uri = URI(url)
      http = Net::HTTP.new(uri.host, uri.port)
      req = Net::HTTP::Get.new(uri.path)
      res = http.request(req)
      res = JSON.parse(res.body)
      res["info"]["metadata"] = Base64.strict_decode64(res["info"]["metadata"]) if res.has_key?("info") && res["info"].has_key?("metadata")
      res
    end
27188
def init():
    
    cwd = _getcwd()
    res = _glfw.glfwInit()
    os.chdir(cwd)
    return res
710213
def get_autostart() -> AutostartSettings:
    """"""
    autostart_file = Path(common.AUTOSTART_DIR) / "autokey.desktop"
    if not autostart_file.exists():
        return AutostartSettings(None, False)
    else:
        return _extract_data_from_desktop_file(autostart_file)
896193
def init(args):
    
    # working directory
    dir_path = Path().absolute()

    if not args.project_name or args.project_name.find("/") >= 0:
        print(
            "{}You should specify a valid project name{}".format(
                utils.colors.FAIL, utils.colors.ENDC
            )
        )
        return

    project_path = dir_path / args.project_name

    # Create the Home Documentation's directory
    if not project_path.exists():
        project_path.mkdir()
    else:
        print(
            "{}This project already exists{}".format(
                utils.colors.FAIL, utils.colors.ENDC
            )
        )
        return

    # Directory with the Home Documentation's source code
    home_doc_path = project_path / "docs"
    home_doc_path.mkdir()
    help_doc_path = home_doc_path / "help"
    help_doc_path.mkdir()

    file_path = Path(__file__).resolve().parent / "include"

    # Add initial files
    copyfile(file_path / "index.md", home_doc_path / "index.md")
    copyfile(file_path / "How_To_Use_Mkinx.md", help_doc_path / "How_To_Use_Mkinx.md")
    copyfile(
        file_path / "Writing_Sphinx_Documentation.md",
        help_doc_path / "Writing_Sphinx_Documentation.md",
    )

    with open(file_path / "mkdocs.yml", "r") as f:
        lines = f.readlines()

    input_text = "What is your Documentation's name"
    input_text += " (it can be changed later in mkdocs.yml)?\n"
    input_text += "[Default: {} - Home Documentation]\n"

    site_name = input(input_text.format(args.project_name.capitalize()))
    if not site_name:
        site_name = "{} - Home Documentation".format(args.project_name.capitalize())

    lines[0] = "site_name: {}\n".format(site_name)

    with open(project_path / "mkdocs.yml", "w") as f:
        f.writelines(lines)

    example_project_path = project_path / "example_project" / "example_project"

    windows = "y" if sys.platform in {"win32", "cygwin"} else "n"

    copytree(file_path / "example_project", example_project_path)
    move(str(example_project_path / "source"), str(project_path / "example_project"))
    move(
        str(project_path / "example_project" / "example_project" / "Makefile"),
        str(project_path / "example_project"),
    )
    if windows == "y":
        move(
            str(project_path / "example_project" / "example_project" / "make.bat"),
            str(project_path / "example_project"),
        )
    else:
        os.remove(
            str(project_path / "example_project" / "example_project" / "make.bat")
        )

    static = project_path / "example_project" / "source"
    static /= "_static"
    if not static.exists():
        static.mkdir()

    _ = subprocess.check_output(
        "cd {} && mkinx build -F -A > /dev/null".format(args.project_name), shell=True
    )

    print(
        "\n\n",
        utils.colors.OKBLUE,
        "{}/{} created as a showcase of how mkinx works".format(
            args.project_name, "example_project"
        ),
        utils.colors.ENDC,
    )

    print(
        "\n",
        utils.colors.OKGREEN,
        "Success!",
        utils.colors.ENDC,
        "You can now start your Docs in ./{}\n".format(args.project_name),
        utils.colors.HEADER,
        "$ cd ./{}".format(args.project_name),
        utils.colors.ENDC,
    )
    print(
        "  Start the server from within your Docs to see them \n  (default",
        "port is 8443 but you can change it with the -s flag):",
    )
    print(
        utils.colors.HEADER,
        " {} $ mkinx serve\n".format(args.project_name),
        utils.colors.ENDC,
    )
1130950
def generate_build_file(startpath, outfilename=DEFAULT_BUILDFILE):
    
    buildfilepath = os.path.join(startpath, outfilename)
    if os.path.exists(buildfilepath):
        raise BuildException("Build file %s already exists." % buildfilepath)

    contents = generate_contents(startpath, outfilename)

    with open(buildfilepath, 'w') as outfile:
        yaml.dump(contents, outfile, default_flow_style=False)
    return buildfilepath