Document file_ops.h

This commit is contained in:
twinaphex 2015-01-16 02:01:05 +01:00
parent c864677b12
commit d4dc802f31
2 changed files with 41 additions and 6 deletions

View File

@ -403,15 +403,15 @@ void save_ram_file(const char *path, int type)
if (size <= 0)
return;
if (write_file(path, data, size))
if (!write_file(path, data, size))
{
RARCH_LOG("Saved successfully to \"%s\".\n", path);
RARCH_ERR("Failed to save SRAM.\n");
RARCH_WARN("Attempting to recover ...\n");
dump_to_file_desperate(data, size, type);
return;
}
RARCH_ERR("Failed to save SRAM.\n");
RARCH_WARN("Attempting to recover ...\n");
dump_to_file_desperate(data, size, type);
RARCH_LOG("Saved successfully to \"%s\".\n", path);
}
/**
@ -642,7 +642,7 @@ bool init_content_file(void)
if (content->elems[i].attr.i & 1)
continue;
ext = path_get_extension(content->elems[i].data);
ext = path_get_extension(content->elems[i].data);
valid_ext = special ? special->roms[i].valid_extensions :
g_extern.system.info.valid_extensions;

View File

@ -29,14 +29,49 @@ extern "C" {
#endif
#ifdef HAVE_COMPRESSION
/* Generic compressed file loader.
* Extracts to buf, unless optional_filename != 0
* Then extracts to optional_filename and leaves buf alone.
*/
long read_compressed_file(const char * path, void **buf,
const char* optional_filename);
#endif
/**
* read_file:
* @path : path to file.
* @buf : buffer to allocate and read the contents of the
* file into. Needs to be freed manually.
*
* Read the contents of a file into @buf. Will call read_compressed_file
* if path contains a compressed file, otherwise will call read_generic_file.
*
* Returns: number of items read, -1 on error.
*/
long read_file(const char *path, void **buf);
/**
* read_file_string:
* @path : path to file to be read from.
* @buf : buffer to allocate and read the contents of the
* file into. Needs to be freed manually.
*
* Reads file content as one string.
*
* Returns: true (1) on success, false (0) otherwise.
*/
bool read_file_string(const char *path, char **buf);
/**
* write_file:
* @path : path to file.
* @data : contents to write to the file.
* @size : size of the contents.
*
* Writes data to a file.
*
* Returns: true (1) on success, false (0) otherwise.
*/
bool write_file(const char *path, const void *buf, size_t size);
#ifdef __cplusplus