Return platform specific config directory.
348953
def get_system_config_directory():
    
    if platform.system().lower() == 'windows':
        _cfg_directory = Path(os.getenv('APPDATA') or '~')
    elif platform.system().lower() == 'darwin':
        _cfg_directory = Path('~', 'Library', 'Preferences')
    else:
        _cfg_directory = Path(os.getenv('XDG_CONFIG_HOME') or '~/.config')

    logger.debug('Fetching configt directory for {}.'
                 .format(platform.system()))
    return _cfg_directory.joinpath(Path('mayalauncher/.config'))
342443
def host_config(self):
        
        if platform.system() == 'Darwin':
            default_file_dir = join(expanduser('~'),
                                    'vent_files')
        else:
            default_file_dir = '/opt/vent_files'
        status = self.ensure_dir(default_file_dir)
        if not isfile(self.cfg_file):
            config = Template(template=self.cfg_file)
            sections = {'main': {'files': default_file_dir},
                        'network-mapping': {},
                        'nvidia-docker-plugin': {'port': '3476'}}
            for s in sections:
                if sections[s]:
                    for option in sections[s]:
                        config.add_option(s, option, sections[s][option])
                else:
                    config.add_section(s)
            config.write_config()
        return status
1347980
def configuration_get_default_folder():
    
    system = platform.system()
    if system == 'Linux':
        # https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
        sys_config_path = Path(os.getenv('XDG_CONFIG_HOME', os.path.expanduser("~/.config")))
    elif system == 'Windows':
        sys_config_path = Path(os.getenv('APPDATA', ''))
    else:
        log.error('Unknown system: "{system}" (using default configuration path)'.format(system=system))
        sys_config_path = Path()
    log.debug('User-specific system configuration folder="{sys_config_path}"'.format(
        sys_config_path=sys_config_path))
    sys_config = sys_config_path / PROJECT_TITLE
    log.debug('User-specific {project} configuration folder="{sys_config}"'.format(
        project=PROJECT_TITLE, sys_config=sys_config))
    return sys_config
1304685
def available_configuration_files(self):
        """"""
        known_files = [GLOBAL_CONFIG, LOCAL_CONFIG, self.environment.get('PIP_ACCEL_CONFIG')]
        absolute_paths = [parse_path(pathname) for pathname in known_files if pathname]
        return [pathname for pathname in absolute_paths if os.path.isfile(pathname)]
628278
def get_config_directory(appname):
    
    if platform.system().lower() == 'windows':
        path = os.path.join(os.getenv('APPDATA') or '~', appname, appname)
    elif platform.system().lower() == 'darwin':
        path = os.path.join('~', 'Library', 'Application Support', appname)
    else:
        path = os.path.join(os.getenv('XDG_CONFIG_HOME') or '~/.config',
                            appname.lower())
    return os.path.expanduser(path)
1359590
def get_pants_configdir():
  """"""
  # Follow the unix XDB base spec: http://standards.freedesktop.org/basedir-spec/latest/index.html.
  config_home = os.environ.get('XDG_CONFIG_HOME')
  if not config_home:
    config_home = '~/.config'
  return os.path.expanduser(os.path.join(config_home, 'pants'))
468470
def _get_config_dirs():
    
    config_dirs = [
        USER_CONFIG_DIR,
        os.path.join("/", "etc", "rapport"),
        os.path.abspath(os.path.join("rapport", "config"))
    ]
    return config_dirs
194696
public function getConfigDirectory()
    {
        $directory = $this->baseDir.DIRECTORY_SEPARATOR.BundleInterface::CONFIG_DIRECTORY_NAME;
        if (false === is_dir($directory)) {
            $directory = $this->baseDir.DIRECTORY_SEPARATOR.BundleInterface::OLD_CONFIG_DIRECTORY_NAME;
        }

        return $directory;
    }
142248
def get_default_home_dir():
    
    ding0_dir = str(cfg_ding0.get('config',
                                  'config_dir'))
    return os.path.join(os.path.expanduser('~'), ding0_dir)
1213269
def user_config_dir():
    
    """
    if WINDOWS:
        path = os.environ.get('APPDATA')
    elif MACOS:
        path = os.path.expanduser('~/Library/Application Support')
    else:
        path = os.environ.get('XDG_CONFIG_HOME') or os.path.expanduser('~/.config')
    if path is None:
        path = ''
    else:
        path = os.path.join(path, 'glances')

    return path
113986
def directory():
    """"""
    home = os.path.expanduser('~')
    if platform.system() == 'Linux':
        hitman_dir = os.path.join(home, '.hitman')
    elif platform.system() == 'Darwin':
        hitman_dir = os.path.join(home, 'Library', 'Application Support',
                                  'hitman')
    elif platform.system() == 'Windows':
        hitman_dir = os.path.join(os.environ['appdata'], 'hitman')
    else:
        hitman_dir = os.path.join(home, '.hitman')
    if not os.path.isdir(hitman_dir):
        os.mkdir(hitman_dir)
    return hitman_dir
762495
function (rootdir, configData, platform, preferenceMappingData) {
        var preferences = lib.getPreferences(rootdir, platform),
            type = 'preference';

        if (!platform) {
            platform = 'generic';
        }

        preferences.forEach(function (preference) {
            // check if there are specific configuration to map to config for this platform
            if (!preferenceMappingData || !preferenceMappingData[platform]) {
                return;
            }

            var prefMappingData = preferenceMappingData[platform][preference.attrib.name],
                target,
                prefData;

            if (prefMappingData) {
                prefData = {
                    parent: prefMappingData.parent,
                    type: type,
                    destination: prefMappingData.destination,
                    data: preference,
                    map: prefMappingData
                };

                target = prefMappingData.target;
                if (!configData[target]) {
                    configData[target] = [];
                }
                configData[target].push(prefData);
            }
        });
    }
1032378
def _get_key_dir():
    '''
    
    '''
    gpg_keydir = None
    if 'config.get' in __salt__:
        gpg_keydir = __salt__['config.get']('gpg_keydir')

    if not gpg_keydir:
        gpg_keydir = __opts__.get(
            'gpg_keydir',
            os.path.join(
                __opts__.get(
                    'config_dir',
                    os.path.dirname(__opts__['conf_file']),
                ),
                'gpgkeys'
            ))

    return gpg_keydir
327817
def get_configdir():
    
    if 'XDG_CONFIG_HOME' in os.environ:
        return os.path.join(os.environ['XDG_CONFIG_HOME'], 'glymur')

    if 'HOME' in os.environ and os.name != 'nt':
        # HOME is set by WinPython to something unusual, so we don't
        # necessarily want that.
        return os.path.join(os.environ['HOME'], '.config', 'glymur')

    # Last stand.  Should handle windows... others?
    return os.path.join(os.path.expanduser('~'), 'glymur')
1222711
def _get_project_conf():
    """"""
    config_settings = {}

    project_root = find_vcs_root(".")
    if project_root is None:
        return config_settings

    for conf_dir in PROJECT_CONF_DIRS:
        conf_dir = conf_dir.lstrip("./")
        joined_dir = os.path.join(project_root, conf_dir) if conf_dir else project_root
        joined_glob = os.path.join(joined_dir, PROJECT_CONF)
        conf_files = glob.glob(joined_glob)
        # config files found, not trying other directories
        if conf_files:
            break
    else:
        conf_files = []

    for conf_file in conf_files:
        try:
            with io.open(conf_file, encoding="utf-8") as input_file:
                loaded_settings = yaml.safe_load(input_file)
        except EnvironmentError:
            logger.warning("Failed to load config from %s", conf_file)
        else:
            logger.info("Config loaded from %s", conf_file)
            config_settings.update(loaded_settings)

    return config_settings
300651
def _in_conf_dir(filename):
    
    return os.path.join(
        os.path.dirname(__file__),
        "templates/conf",
        filename
    )
269141
def platform_cache_dir():
    
    if WIN32:  # nocover
        dpath_ = '~/AppData/Local'
    elif LINUX:  # nocover
        dpath_ = '~/.cache'
    elif DARWIN:  # nocover
        dpath_  = '~/Library/Caches'
    else:  # nocover
        raise NotImplementedError('Unknown Platform  %r' % (sys.platform,))
    dpath = normpath(expanduser(dpath_))
    return dpath