Determine the default base directory path

    If the OS_REFRESH_CONFIG_BASE_DIR environment variable is set,
    use its value.
    Otherwise, prefer the new default path, but still allow the old one for
    backwards compatibility.
163525
def default_base_dir():
    
    base_dir = os.environ.get('OS_REFRESH_CONFIG_BASE_DIR')
    if base_dir is None:
        # NOTE(bnemec): Prefer the new location, but still allow the old one.
        if os.path.isdir(OLD_BASE_DIR) and not os.path.isdir(DEFAULT_BASE_DIR):
            logging.warning('Base directory %s is deprecated. The recommended '
                            'base directory is %s',
                            OLD_BASE_DIR, DEFAULT_BASE_DIR)
            base_dir = OLD_BASE_DIR
        else:
            base_dir = DEFAULT_BASE_DIR
    return base_dir
19213
def set_path (self, path):
        
        assert isinstance(path, basestring)
        self.path_ = os.path.normpath(path)
405893
function(basePath, config) {
    this._basePath = basePath;
    this._config = config;

    var directories = IOUtils.getDirectoryList(basePath, false);
    IOUtils.createPathIfNotExists(directories, './');
}
712180
def get_env_default(self, variable, default):
        
        if variable in os.environ:
            env_var = os.environ[variable]
        else:
            env_var = default
        return env_var
488510
def _get_config_dir():
    
    if 'SAWTOOTH_HOME' in os.environ:
        return os.path.join(os.environ['SAWTOOTH_HOME'], 'etc')

    if os.name == 'nt':
        base_dir = \
            os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0])))
        return os.path.join(base_dir, 'conf')

    return '/etc/sawtooth'
180925
def ensure_dir_path(self, path, relative=False):
        
        if not relative:
            rel_path = self.relpath(path)
        else:
            rel_path = path

        # Locator
        if self.is_locator(rel_path, relative=True):
            path = path.rstrip('/')

        # Directory
        elif rel_path:
            path = path.rstrip('/') + '/'
        # else: root
        return path
231034
def basename(path, ext=""):
    """"""
    import os.path
    if ext is False:
        return os.path.basename(path).replace(extname(path), "")
    else:
        return os.path.basename(path).replace(ext, "")
19504
def basename(path: Optional[str]) -> Optional[str]:
    
    if path is not None:
        return os.path.basename(path)
238107
function getConfiguredPath (path) {
    if (options.useBasePath && context.api && context.api.basePath) {
      return context.api.basePath + path;
    }
    else {
      return path;
    }
  }
717854
def index_path(self, root):
        
        basename = os.path.basename(root)
        if os.path.splitext(basename)[0] != '__init__' and basename.startswith('_'):
            return
        location = self._determine_location_for(root)
        if os.path.isfile(root):
            self._index_module(root, location)
        elif os.path.isdir(root) and os.path.exists(os.path.join(root, '__init__.py')):
            self._index_package(root, location)
203347
def set_mypy_path(mypy_path):
    """"""
    original = os.environ.get(mypy_path_env_var)
    if original is None:
        new_mypy_path = mypy_path
    elif not original.startswith(mypy_path):
        new_mypy_path = mypy_path + os.pathsep + original
    else:
        new_mypy_path = None
    if new_mypy_path is not None:
        logger.log(mypy_path_env_var + ":", new_mypy_path)
        os.environ[mypy_path_env_var] = new_mypy_path
442846
def get_path_name(self):
        
        path = fix_raw_path(os.path.dirname(os.path.abspath(self.path)))
        name = os.path.basename(self.path)
        return path, name
832055
def get_parent_dir(base_dir, level=1):
    ""
    while level > 0:
        base_dir = os.path.dirname(base_dir)
        level -= 1
    return base_dir
1339201
protected function checkEnvironmentPath() {
		// Create folder if it doesn't exist
		$configDir = dirname($this->getConfigFilename());
		if(!file_exists($configDir) && $configDir) {
			mkdir($configDir, 0777, true);
		}
	}
755772
def determine_path():
    """"""
    root = __file__
    if os.path.islink(root):
        root = os.path.realpath(root)
    return os.path.dirname(os.path.abspath(root))
265336
def set_base_dir(self, base_dir):
        

        self._base_dir = base_dir
        self.icon_cache.set_base_dir(base_dir)
829777
def get_config_path():
    """"""
    dir_path = (os.getenv('APPDATA') if os.name == "nt"
                else os.path.expanduser('~'))
    return os.path.join(dir_path, '.vtjp')