Exemplo n.º 1
0
Arquivo: cgdb.c Projeto: i4fumi/cgdb
static int init_home_dir(void)
{
    /* Get the home directory */
    char *home_dir = getenv("HOME");
    const char *cgdb_dir = ".cgdb";

    /* Create the config directory */
    if (!fs_util_create_dir_in_base(home_dir, cgdb_dir)) {
        logger_write_pos(logger, __FILE__, __LINE__,
                "fs_util_create_dir_in_base error");
        return -1;
    }

    fs_util_get_path(home_dir, cgdb_dir, cgdb_home_dir);

    return 0;
}
Exemplo n.º 2
0
/* 
 * Gets the users home dir and creates the config directory.
 *
 * \param tgdb
 * The tgdb context.
 *
 * \param config_dir 
 * Should be FSUTIL_PATH_MAX in size on way in.
 * On way out, it will be the path to the config dir
 *
 * \return
 * -1 on error, or 0 on success
 */
int Ctgdb::Initialize_config_dir (char *config_dir)
{
	/* Get the home directory */
	char *home_dir = getenv ("HOME");
	const char *tgdb_dir = ".tgdb";

	/* Create the config directory */
	if (!fs_util_create_dir_in_base (home_dir, tgdb_dir))
	{
		Logger_write_pos( __FILE__, __LINE__,
				"fs_util_create_dir_in_base error");
		return -1;
	}

	fs_util_get_path (home_dir, tgdb_dir, config_dir);

	return 0;
}