Example #1
0
bool config_file_write(config_file_t *conf, const char *path, bool sort)
{
   if (!string_is_empty(path))
   {
      void* buf  = NULL;
#ifdef ORBIS
      int fd     = orbisOpen(path,O_RDWR|O_CREAT,0644);
      if (fd < 0)
         return false;
      config_file_dump_orbis(conf,fd);
      orbisClose(fd);
#else
      FILE *file = (FILE*)fopen_utf8(path, "wb");
      if (!file)
         return false;

      /* TODO: this is only useful for a few platforms, find which and add ifdef */
#if !defined(PS2) && !defined(PSP)
      buf = calloc(1, 0x4000);
      setvbuf(file, (char*)buf, _IOFBF, 0x4000);
#endif

      config_file_dump(conf, file, sort);

      if (file != stdout)
         fclose(file);
      free(buf);
#endif
   }
   else
      config_file_dump(conf, stdout, sort);

   return true;
}
Example #2
0
bool config_file_write(config_file_t *conf, const char *path)
{
   if (!string_is_empty(path))
   {
      void* buf  = NULL;
      FILE *file = (FILE*)fopen_utf8(path, "wb");
      if (!file)
         return false;

      /* TODO: this is only useful for a few platforms, find which and add ifdef */
      buf = calloc(1, 0x4000);
      setvbuf(file, (char*)buf, _IOFBF, 0x4000);

      config_file_dump(conf, file);

      if (file != stdout)
         fclose(file);
      free(buf);
   }
   else
      config_file_dump(conf, stdout);

   return true;
}
Example #3
0
bool config_file_write(config_file_t *conf, const char *path)
{
	FILE *file;

	if (path)
	{
		file = fopen(path, "w");
		if (!file)
			return false;
	}
	else
		file = stdout;

	config_file_dump(conf, file);

	if (path)
		fclose(file);

	return true;
}