mirror of
https://github.com/libretro/RetroArch
synced 2025-02-28 22:13:51 +00:00
Document file_ops.h
This commit is contained in:
parent
c864677b12
commit
d4dc802f31
12
content.c
12
content.c
@ -403,15 +403,15 @@ void save_ram_file(const char *path, int type)
|
|||||||
if (size <= 0)
|
if (size <= 0)
|
||||||
return;
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RARCH_ERR("Failed to save SRAM.\n");
|
RARCH_LOG("Saved successfully to \"%s\".\n", path);
|
||||||
RARCH_WARN("Attempting to recover ...\n");
|
|
||||||
dump_to_file_desperate(data, size, type);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -642,7 +642,7 @@ bool init_content_file(void)
|
|||||||
if (content->elems[i].attr.i & 1)
|
if (content->elems[i].attr.i & 1)
|
||||||
continue;
|
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 :
|
valid_ext = special ? special->roms[i].valid_extensions :
|
||||||
g_extern.system.info.valid_extensions;
|
g_extern.system.info.valid_extensions;
|
||||||
|
|
||||||
|
35
file_ops.h
35
file_ops.h
@ -29,14 +29,49 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_COMPRESSION
|
#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,
|
long read_compressed_file(const char * path, void **buf,
|
||||||
const char* optional_filename);
|
const char* optional_filename);
|
||||||
#endif
|
#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);
|
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);
|
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);
|
bool write_file(const char *path, const void *buf, size_t size);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
Loading…
x
Reference in New Issue
Block a user