#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
Go to the source code of this file.
|
int | xemu_load_file (const char *filename, void *store_to, int min_size, int max_size, const char *cry) |
|
int | xemu_save_file (const char *filename, void *data, int size, const char *cry) |
|
int | xemu_open_file (const char *filename, int mode, int *mode2, char *filepath_back) |
|
ssize_t | xemu_safe_read (int fd, void *buffer, size_t length) |
|
ssize_t | xemu_safe_write (int fd, const void *buffer, size_t length) |
|
int | xemu_safe_close (int fd) |
|
off_t | xemu_safe_file_size_by_fd (int fd) |
|
off_t | xemu_safe_file_size_by_name (const char *name) |
|
int | xemu_create_large_empty_file (const char *os_path, Uint64 size, int is_sparse) |
|
void | xemuexec_open_native_file_browser (char *dir) |
|
◆ FILE_BROWSER
#define FILE_BROWSER "xdg-open" |
◆ OFF_T_ERROR
#define OFF_T_ERROR ((off_t)-1) |
◆ UNIX_DATADIR_0
#define UNIX_DATADIR_0 "/usr/local/share/xemu" |
◆ UNIX_DATADIR_1
#define UNIX_DATADIR_1 "/usr/local/lib/xemu" |
◆ UNIX_DATADIR_2
#define UNIX_DATADIR_2 "/usr/share/xemu" |
◆ UNIX_DATADIR_3
#define UNIX_DATADIR_3 "/usr/lib/xemu" |
◆ WEB_BROWSER
#define WEB_BROWSER "xdg-open" |
◆ XEMU_OPEN_FILE_FIRST_MODE_USED
#define XEMU_OPEN_FILE_FIRST_MODE_USED -1 |
◆ xemu_create_large_empty_file()
int xemu_create_large_empty_file |
( |
const char * |
os_path, |
|
|
Uint64 |
size, |
|
|
int |
is_sparse |
|
) |
| |
◆ xemu_load_file()
int xemu_load_file |
( |
const char * |
filename, |
|
|
void * |
store_to, |
|
|
int |
min_size, |
|
|
int |
max_size, |
|
|
const char * |
cry |
|
) |
| |
◆ xemu_open_file()
int xemu_open_file |
( |
const char * |
filename, |
|
|
int |
mode, |
|
|
int * |
mode2, |
|
|
char * |
filepath_back |
|
) |
| |
Open a file (probably with special search paths, see below), returning a file descriptor, or negative value in case of failure.
Central part of file handling in Xemu.
- Parameters
-
*filename | name of the file
- if it begins with '@' the file is meant to relative to the SDL preferences directory (ie: @thisisit.rom, no need for dirsep!)
- if it begins with '#' the file is meant for 'data directory' which is probed then multiple places, depends on the OS as well
- Note: in this case, if installer is enabled and file not found, Xemu can try to download the file. For this, see above the "installer" part of this source
- otherwise it's simply a file name, passed as-is
|
mode | actually the flags parameter for open (O_RDONLY, etc)
- O_BINARY is used automatically in case of Windows, no need to specify as input data
- you can even use creating file effect with the right value here
|
*mode2 | pointer to an int, secondary open mode set
- if it's NULL pointer, it won't be used ever
- if it's not NULL, open() is also tried with the pointed flags for open() after trying (and failed!) open() with the 'mode' par
- if mode2 pointer is not NULL, the pointed value will be set to XEMU_OPEN_FILE_FIRST_MODE_USED by this func, if NOT *mode2 is used with successfull open
- the reason for this madness: opening a disk image which neads to be read/write access, but also works for read-only, however then the caller needs to know if the disk emulation is about r/w or ro only ...
|
*filepath_back | if not null, actually tried path will be placed here (even in case of non-successfull call, ie retval is negative)
- in case of multiple-path tries (# prefix) the first (so the most relevant, hopefully) is passed back
- note: if no prefix (@ and #) the filename will be returned as is, even if didn't hold absolute path (only relative) or no path as all (both: relative to cwd)!
|
Definition at line 469 of file emutools_files.c.
◆ xemu_safe_close()
int xemu_safe_close |
( |
int |
fd | ) |
|
◆ xemu_safe_file_size_by_fd()
off_t xemu_safe_file_size_by_fd |
( |
int |
fd | ) |
|
◆ xemu_safe_file_size_by_name()
off_t xemu_safe_file_size_by_name |
( |
const char * |
name | ) |
|
◆ xemu_safe_read()
ssize_t xemu_safe_read |
( |
int |
fd, |
|
|
void * |
buffer, |
|
|
size_t |
length |
|
) |
| |
◆ xemu_safe_write()
ssize_t xemu_safe_write |
( |
int |
fd, |
|
|
const void * |
buffer, |
|
|
size_t |
length |
|
) |
| |
◆ xemu_save_file()
int xemu_save_file |
( |
const char * |
filename, |
|
|
void * |
data, |
|
|
int |
size, |
|
|
const char * |
cry |
|
) |
| |
◆ xemuexec_open_native_file_browser()
void xemuexec_open_native_file_browser |
( |
char * |
dir | ) |
|
◆ xemu_load_buffer_p
◆ xemu_load_filepath
char xemu_load_filepath[PATH_MAX] |