示例#1
0
文件: io.c 项目: salinasv/Chronus
char* config_get_password()
{
	char *path;
	FILE *fd;
	char buffer[100];
	char *password;

	path = config_get_filename();

	/* TODO: Create the file if it doesn't exist */
	if (!fd) {
		printf("There is not config file %d\n", errno);
		return NULL;
	}

	fd = fopen(path, "r");
	fgets(buffer, 100, fd);
	fgets(buffer, 100, fd);

	password = g_strdup(buffer);

	fclose(fd);

	return g_strstrip(password);
}
示例#2
0
文件: test.c 项目: salinasv/Chronus
/**********************************************************
 * IO Test
 *********************************************************/
void test_io_config_get_filename()
{
	char *file;

	file = config_get_filename();

	printf("Config Filename: %s\n", file);
	
	g_free(file);
}
示例#3
0
static void
_gui_save_config(Config *config)
{
	GError *err = NULL;

	if(config_get_filename(config))
	{
		g_debug("Saving configuration");
		config_save(config, &err);
	}
	else
	{
		g_debug("Saving configuration: \"%s\"", pathbuilder_get_config_filename());
		config_save_as(config, pathbuilder_get_config_filename(), &err);
	}

	if(err)
	{
		g_warning("%s", err->message);
		g_error_free(err);
		err = NULL;
	}
}