Go to the source code of this file.
Functions |
| void | LOG (LogLevel logLevel, char *format,...) |
| void | system_start () |
| void | system_end () |
| char * | get_word_from_string (char *str, int *pos) |
| static int | mkdir_recurse (const char *path) |
| void | copy_file (const char *filename, const char *filename_out) |
| void | copy_if_exists (const char *from, const char *to, const char *src, const char *dst) |
| void | rmrf (const char *path) |
| void | copy_rec (const char *src, const char *dst) |
| const char * | get_config_dir () |
| void | get_data_dir_file (char *buf, size_t len, const char *fname) |
| char * | file_path (const char *fname, const char *mode) |
| FILE * | fopen_wrapper (const char *fname, const char *mode) |
| SDL_Surface * | IMG_Load_wrapper (const char *file) |
| TTF_Font * | TTF_OpenFont_wrapper (const char *file, int ptsize) |
Variables |
|
static FILE * | logstream = NULL |
| static const char *const | loglevel_names [] |
Detailed Description
General convenience functions for the client.
Definition in file wrapper.c.
Function Documentation
| void copy_file |
( |
const char * |
filename, |
|
|
const char * |
filename_out |
|
) |
| |
Copy a file.
- Parameters:
-
| filename | Source file. |
| filename_out | Destination file. |
Definition at line 202 of file wrapper.c.
| void copy_if_exists |
( |
const char * |
from, |
|
|
const char * |
to, |
|
|
const char * |
src, |
|
|
const char * |
dst |
|
) |
| |
Copy a file/directory if it exists.
- Parameters:
-
| from | Directory where to copy from. |
| to | Directort to copy to. |
| src | File/directory to copy. |
| dst | Where to copy the file/directory to. |
Definition at line 251 of file wrapper.c.
| void copy_rec |
( |
const char * |
src, |
|
|
const char * |
dst |
|
) |
| |
Recursively copy a file or directory.
- Parameters:
-
| src | Source file/directory to copy. |
| dst | Where to copy to. |
Definition at line 315 of file wrapper.c.
| char* file_path |
( |
const char * |
fname, |
|
|
const char * |
mode |
|
) |
| |
Get path to file, to implement saving settings related data to user's home directory.
- Parameters:
-
| fname | The file path. |
| mode | File mode. |
- Returns:
- The path to the file.
Definition at line 420 of file wrapper.c.
| const char* get_config_dir |
( |
| ) |
|
Get configuration directory.
- Returns:
- The configuration directory.
Definition at line 369 of file wrapper.c.
| void get_data_dir_file |
( |
char * |
buf, |
|
|
size_t |
len, |
|
|
const char * |
fname |
|
) |
| |
Get path to a file in the data directory.
- Parameters:
-
| buf | Buffer where to store the path. |
| len | Size of buf. |
| fname | File. |
Definition at line 394 of file wrapper.c.
| char* get_word_from_string |
( |
char * |
str, |
|
|
int * |
pos |
|
) |
| |
Get a single word from a string, free from left and right whitespace.
- Parameters:
-
| str | The string pointer |
| pos | The position pointer |
- Returns:
- The word, or NULL if there is no word left
Definition at line 127 of file wrapper.c.
| void LOG |
( |
LogLevel |
logLevel, |
|
|
char * |
format, |
|
|
|
... |
|
) |
| |
Logs an error, debug output, etc.
- Parameters:
-
| logLevel | Level of the log message (llevInfo, llevDebug, ...) |
| format | Formatting of the message, like sprintf |
| ... | Additional arguments for format |
Definition at line 49 of file wrapper.c.
| static int mkdir_recurse |
( |
const char * |
path | ) |
[static] |
Recursively creates directories from path.
Used by file_path().
- Parameters:
-
- Returns:
- 0 on success, -1 otherwise
Definition at line 162 of file wrapper.c.
| void rmrf |
( |
const char * |
path | ) |
|
Recursively remove a directory and its contents.
Effectively same as 'rf -rf path'.
- Parameters:
-
Definition at line 269 of file wrapper.c.
Start the base system, setting caption name and window icon.
Definition at line 84 of file wrapper.c.
Variable Documentation
Initial value:
{
"[Error] ",
"[Bug] ",
"[Debug] ",
"[Info] "
}
Human-readable names of log levels.
Definition at line 36 of file wrapper.c.