コード例 #1
0
ファイル: config.c プロジェクト: AnimatorPro/Animator-Pro
/* re opens config file for readwrite with global name. The path is assumed
 * to be full or is relative to the startup drawer */
static Errcode
open_config(XFILE **pxf, Boolean create)
{
	Errcode err;
	FilePath *filepath;
	char odir[PATH_SIZE];
	const char *config_name = vb.config_name;

	if (!pj_assert(vb.config_name != NULL)) return Err_abort;

	filepath = filepath_create_from_string(vb.init_drawer);
	if (filepath != NULL) {
		err = filepath_append(filepath, vb.config_name);

		if (err == Success)
			err = filepath_to_cstr(filepath, DIR_DELIM, odir, sizeof(odir));

		if (err == Success)
			config_name = odir;

		filepath_destroy(filepath);
	}

	return xffopen(config_name, pxf,
			create ? XREADWRITE_CLOBBER : XREADWRITE_OPEN);
}
コード例 #2
0
ファイル: path_ts.c プロジェクト: tniuli/xio
static int path_walk_test()
{
	filepath_t fp = {};

	filepath_init (&fp, "");
	fp_walkdir (&fp, my_walkfn, NULL);
	fp_dwalkdir (&fp, my_walkfn, NULL, -1);
	BUG_ON (entries_cnt == 0);
	filepath_destroy (&fp);
	return 0;
}
コード例 #3
0
ファイル: devsels.c プロジェクト: AnimatorPro/Animator-Pro
static void go_updir(Button *b)
/* move up one directory */
{
	Dsel_group *dg = b->group;
	FilePath *filepath;

	hilight(b);

	filepath = filepath_create_from_string(dg->drawer);
	if (filepath != NULL) {
		filepath_drop_tail(filepath);
		filepath_to_cstr(filepath, DIR_DELIM, dg->drawer, PATH_SIZE);
		filepath_destroy(filepath);
	}

	(*dg->on_newdrawer)(dg->on_newd_data);
	draw_buttontop(b);
}