示例#1
0
文件: main.cpp 项目: dmpas/e8engine
static void
load_global_settings(e8_environment env, e8_translator tr)
{
    char *bp = get_global_config_path();
    char *cfg = static_cast<char*>( malloc(strlen(bp) + strlen("e8script.cfg") + 2) );
    sprintf(cfg, "%s/%s", bp, "e8script.cfg");

    free(bp);

    settings_from_file(cfg, env, tr);

    free(cfg);

    /* Пытаемся подгрузить дополнительные настройки из пользовательских каталогов */
    #ifdef __WINNT
    settings_from_file("%AppData\\e8script\\e8script.cfg", env, tr);
    settings_from_file("%LocalAppData\\e8script\\e8script.cfg", env, tr);
    #endif
    #ifdef __linux
    settings_from_file("~/.e8script/e8script.cfg", env, tr);
    settings_from_file("~/e8script/e8script.cfg", env, tr);
    #endif // __linux

}
示例#2
0
void
fpp_config_initialize(void)
{
    if (initialized)
        return;

    config_t    cfg;
    char       *local_config = get_local_config_path(config_file_name);
    char       *global_config = get_global_config_path(config_file_name);

    config = default_config;

    config_init(&cfg);

    if (!config_read_file(&cfg, local_config)) {
        if (!config_read_file(&cfg, global_config)) {
            goto quit;
        }
    }

    long long intval;
    const char *stringval;

    if (config_lookup_int64(&cfg, "audio_buffer_min_ms", &intval)) {
        config.audio_buffer_min_ms = intval;
    }

    if (config_lookup_int64(&cfg, "audio_buffer_max_ms", &intval)) {
        config.audio_buffer_max_ms = intval;
    }

    if (config_lookup_int64(&cfg, "xinerama_screen", &intval)) {
        config.xinerama_screen = intval;
    }


    if (config_lookup_string(&cfg, "pepperflash_path", &stringval)) {
        config.pepperflash_path = strdup(stringval);
    }

    if (config_lookup_string(&cfg, "flash_command_line", &stringval)) {
        config.flash_command_line = strdup(stringval);
    }

    if (config_lookup_int64(&cfg, "enable_3d", &intval)) {
        config.enable_3d = intval;
    }

    config_destroy(&cfg);

quit:
    g_free(local_config);
    g_free(global_config);

    initialize_quirks();

    // calculate plugin data directory
    local_config = get_local_config_path(config_dir_name);
    pepper_data_dir = g_strdup_printf("%s/%s", local_config, fpp_config_get_plugin_name());
    pepper_salt_file_name = g_strdup_printf("%s/%s", local_config, salt_file_name);
    g_free(local_config);

    initialized = 1;
}