Exemplo n.º 1
0
static int try_for_R_path (HKEY tree, char *s)
{
    int err = 0;

    /* this used to work with R 2.9.1 */
    err = read_reg_val(tree, "R-core\\R", "InstallPath", s);

    if (err) {
	char version[8], path[32];

	/* new-style: path contains R version number */
	err = read_reg_val(tree, "R-core\\R", "Current Version", 
			   version);
	if (!err) {
	    sprintf(path, "R-core\\R\\%s", version);
	    err = read_reg_val(tree, path, "InstallPath", s);
	}
    }

    if (err) {
	/* did this variant work at one time? */
	err = read_reg_val(tree, "R", "InstallPath", s);
    }

    return err;
}
Exemplo n.º 2
0
void win32_cli_read_rc (char *callname)
{
    ConfigPaths cpaths = {0};
    char dbproxy[64] = {0};
    int use_proxy = 0;
    FILE *fp;
    
    /* try for a per-user rc file first */
    fp = cli_rcfile_open();
    if (fp != NULL) {
	get_gretl_config_from_file(fp, &cpaths, dbproxy, &use_proxy);
	fclose(fp);
    }

    /* read the "gretlnet" file, if present: any settings from this
       file will override those from the per-user rc file.
    */ 
    fp = cli_gretlnet_open(callname);
    if (fp != NULL) {
	get_gretl_config_from_file(fp, &cpaths, dbproxy, &use_proxy);
	fclose(fp);
    }	
    
    /* for a short list of items, if they're (still) missing, maybe we 
       can get them from the registry 
    */

    if (cpaths.gretldir[0] == '\0') {
	read_reg_val(HKEY_LOCAL_MACHINE, "gretl", "gretldir",
		     cpaths.gretldir);
    }

    if (cpaths.x12a[0] == '\0') {
	read_reg_val(HKEY_LOCAL_MACHINE, "x12arima", "x12a",
		     cpaths.x12a);
    }

    if (cpaths.tramo[0] == '\0') {
	read_reg_val(HKEY_LOCAL_MACHINE, "tramo", "tramo",
		     cpaths.tramo);
    }	

    gretl_set_paths(&cpaths);
    gretl_www_init(cpaths.dbhost, dbproxy, use_proxy);
}
Exemplo n.º 3
0
void gretl_win32_init (const char *progname, int debug)
{
    char tmp[4] = {0};

    set_gretlnet_filename(progname);

    /* Are we using the XP theme (as opposed to "classic")?
       In that case we'll make use of libwimp the default,
       prior to reading the user's config file.
    */
    read_reg_val(HKEY_CURRENT_USER, 
		 "Microsoft\\Windows\\CurrentVersion\\ThemeManager", 
		 "ThemeActive", tmp);
    set_wimp_preferred(!strcmp(tmp, "1"));

    read_win32_config(debug);
    set_gretl_startdir();
}